Question

I'm trying to get events like select / change or something useful from jquery-ui Autocomplete Combobox.

I have create the simple scenario on http://jsfiddle.net/QSMv5/ This is the example you can find on jquery-ui site http://jqueryui.com/autocomplete/#combobox.

Simply trying something like the following do nothing:

 $( "#combobox" ).click(function() {
      alert('hi');
    });

But for example this works it I trigger the event from code.

So I think this could be probably due to event propagation or something similar..

Does anyone could point me to right direction and get event fired when user select from DropDown?

Était-ce utile?

La solution

For this specific scenery, you can use something like this: (see http://jsfiddle.net/QSMv5/2/)

$( ".custom-combobox-input" ).on( "autocompleteselect", function() { 
    alert('hi') 
} );    

But, note that .custom-combobox-input is a class used in the input element of this example. On your real code, this may be different.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top