How To Get DropDownList Selected Text using JQuery


You have a ASP.NET DropDownList control on page and you want to get its selected text 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 name from the above DropDownList control.

var country = $("#DropDownList1 option:selected").text();

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments 1

user
Sourav Basak
  • 02 October 2015

jQuery select elements typically have two values which you want to access. First thing is that there is the value that you can get i.e. $( "#selectID" ).val(); And the second thing is the text value of the select box. $("#selectID option:selected").text(); For more: http://www.namasteui.com/get-selected-text-from-drop-down-list-in-jquery/

Add Comment