Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery multiselect event handler

I have an html dropdown. I want to fire an event whenever the selection changes in any way. I tried registering 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?

like image 387
john Avatar asked Mar 30 '11 20:03

john


2 Answers

Try using the onchange event.

$('#mySelect').change(function(){
    alert($(this).val());
});
like image 96
Rocket Hazmat Avatar answered Nov 13 '22 22:11

Rocket Hazmat


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...

like image 3
thesunneversets Avatar answered Nov 13 '22 22:11

thesunneversets