Jquery multiselect event handler

I have a html dropdown. I want to fire an event whenever the selection changes in any way. I tried to register the 'click' event, but this did not work on multiple selections (either by dragging the mouse or restraining the shift + down arrow).

So how can I fire an event on any change?

+5
source share
3 answers

Try using an event onchange.

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

Will .change () do the trick?

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

Of course, this page has a working demo of multi-screen selection ...

+2
source

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

function myChangeEvent(e){

}
0

All Articles