如问题所述,如何使用jQuery设置DropDownList控件的值?
3 回答

牛魔王的故事
TA贡献1830条经验 获得超3个赞
我做上面的方式曾经工作。但似乎不再。
但是正如Han在评论中愉快地指出的那样,正确的做法是:
$("#mydropdownlist").get(0).selectedIndex = index_here;

慕丝7291255
TA贡献1859条经验 获得超6个赞
试试这个非常简单的方法:
/*make sure that value is included in the options value of the dropdownlist
e.g.
(<select><option value='CA'>California</option><option value='AK'>Alaska</option> </select>)
*/
$('#mycontrolId').val(myvalue).attr("selected", "selected");
- 3 回答
- 0 关注
- 499 浏览
添加回答
举报
0/150
提交
取消