JSFiddle - React, Tailwind, and code Playground
HTML
<input type='text' id='elem'/>
CSS
@import url("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/themes/base/jquery-ui.css");
JavaScript
$( function(){
var elem = $('#elem');
elem.autocomplete({
minLength : 0,
source: ['1', '2', '3', '4', '5'],
select : function(event, ui) {
alert('foo!');
}
});
elem.bind('autocompleteselect',
function(event, ui){alert('bar!');});
// on automatic 'autocompleteselect' trigger (from UI)
// both handlers will fire
// If we manually trigger selection
elem.trigger('select', {});
// the first handler won't fire - however, the second will
});