开发者

setting a value of ASP:Dropdown using jquery

I am trying to set a value for DDL say

$('#ddlState').val("State");  //State matched the name in DD list value

i have this lin开发者_StackOverflow中文版e in ready function and it works for text boxes but not DDL.

I am also using labelify plugin for text boxes but when i set values like

$('#txtBox').val("Some Value"); //Which is not same as title value

the some value is showing in the grey color.

Any clue?


Well for starters, .NET doesn't render the controls as

$('ddlState');

Try doing this:

$('#<% ddlState.ClientID %>').val('State');


Check out this answer:

Adding options to a <select> using jQuery?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜