We will see how to Get Dropdown selected Value using javascript..?
First create javascript function as GetMaster1Details:
- function GetMaster1Details()
- {
- var value = document.getElementById("<%=ddlMaster1.ClientID%>");
- var getvalue = value.options[value.selectedIndex].value;
- var gettext = value.options[value.selectedIndex].text;
- alert("value:-" +" "+ getvalue + " "+ "Text:-" +" "+ gettext);
- }
Then use this function to dropdown on onchange event as:
- <asp:DropDownList ID="ddlMaster1" runat="server" onchange="GetMaster1Details()">
- </asp:DropDownList>
And See output is: