c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
JQuery

How to get selected dropdown text using jquery in asp.net?

| | ASP , ASP-NET , JQuery

In this Article, I explain how to get selected dropdown text using jqueryin asp.net. Here I am using jquery 1.8.3 for achieve this. Here I demonstrate asimple example of binding country with dropdownlist.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<script type="text/javascript">

     function getvalue() {

        var cbocountry = $('#cbocountry');       

        var selecttext = cbocountry.find('option:selected').text();

        alert(selecttext);

    }

 </script>
<asp:DropDownList ID="cbocountry" runat="server">

                <asp:ListItem Text="India" Selected="True" Value="1" />

                <asp:ListItem Text="UAE" Value="2" />

                <asp:ListItem Text="KSA" Value="3" />

            </asp:DropDownList>

 <asp:Button ID="Button1" runat="server" Text="Getselectedvalue" OnClientClick="getvalue()" />