开发者

Jquery multiselect event handler

I have an html dropdown. I want to fire an event whenever the selection changes in any way. I tried r开发者_StackOverflowegistering a 'click' event but this didnt work when multi-selecting (either by dragging the mouse or holding down shift + down arrow).

So basically, how can I fire an event on any selection change?


Try using the onchange event.

$('#mySelect').change(function(){
    alert($(this).val());
});


Would .change() do the trick?

http://api.jquery.com/change/

Certainly there seems to be a working demo of a multi-select box on that page...


jquery 1.4: $("#mySelector").change(myChangeEvent); before: $("#mySelector").bind("change", myChangeEvent);

function myChangeEvent(e){

}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜