简体   繁体   中英

Event not fired on Autocomplete Combobox

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM