Jquery : Setting Dropdownlist value using Jquery

We can set Dropdownlist Value using Jquery as mentioned below.

if we are having dropdownlist as follows

<asp:DropDownList runat=”server” ID=”ddlDropDownList“>
<asp:ListItem Text=”<– Select –>” Value=”0″></asp:ListItem>
<asp:ListItem Text=”TEST1″ Value=”1″></asp:ListItem>
<asp:ListItem Text=”TEST2″ Value=”2″></asp:ListItem>
<asp:ListItem Text=”TEST3″ Value=”3″></asp:ListItem>
</asp:DropDownList>

THEN ,we can set selection of the dropdown list to “<– Select –>”  when we required or after processing done as below.

$(“select[id$=ddlDropDownList]”).val(“0”);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s