JQuery

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

How to get selected dropdown value using jquery in asp.net?, someone asked me to explain?

In this Article, I explain how to get selected dropdown value usingj query in asp.net. Here I am using jquery 1.8.3 for achieve this. Here I demonstrate a simple example of binding a 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 selectedvalue = $('#cbocountry').val();

        alert(selectedvalue);

    }

 </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()" />

Post your comments / questions