include option name in jquery code example

Example 1: jqury get selected option

<select id="myselect">
    <option value="1">Mr</option>
    <option value="2">Mrs</option>
    <option value="3">Ms</option>
    <option value="4">Dr</option>
    <option value="5">Prof</option>
</select>

<script>
$( "#myselect option:selected" ).val();
</script>

Example 2: jquery get dropdown selected value

<asp:DropDownList ID="DropDownListId" runat="server" CssClass="DropDownListClass"></asp:DropDownList>

var value1 = $("[id*=DropDownListId]").val();
var value2 = $(".DropDownListClass").val();

Example 3: jquery get selected option value

jquery get selected option value

Tags:

Misc Example