开发者

How to fire select value change even in a combo box programmatically?

I've a combo box and want to select an option value. I'm using something like:

$("#comState_city option:eq(0)").attr("value",chk[i]);
$("#comSt开发者_C百科ate_city option:eq(0)").attr("selected","selected");

But this isn't firing value change event. I want the onchange handler be called when I changed the value of a select element.


$('#comState_city option:eq(0)').trigger('change');


Try this one:

$("#comState_city").change(function(){
    alert($(this[this.selectedIndex]).val());
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜