May 10, 2012

How To Get DropDownList Selected Value using JQuery


You have a ASP.NET DropDownList control on page and you want to get selected item value using
JQuery. You can using following code snippet.
Here is the code for DropDownList control.
<asp:DropDownList ID="DropDownList1" runat="server" >
   <asp:ListItem Value="1">Germany</asp:ListItem>
   <asp:ListItem Value="2">France</asp:ListItem>
   <asp:ListItem Value="3">Brazil</asp:ListItem>
</asp:DropDownList>

Following JQuery code snippet will give you selected country value from the above DropDownList
control.
var countryId = $("#DropDownList1 option:selected").val();

0 comments:

Post a Comment

Your comments:

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More