I had the same issue, even using the latest version of jquery-ui available at the time 1.11.4
Checking the source code in file jquery-ui.js I found a piece like this:
"click .ui-menu-item": function( event ) {
var target = $( event.target );
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
this.select( event );
// Only set the mouseHandled flag if the event will bubble, see #9469.
if ( !event.isPropagationStopped() ) {
this.mouseHandled = true;
}
The problem is the mouseHandled
var set to true
. But it only happens if the event
propagation hasn't been stopped.
So as the solution I defined my autocomplete like this:
$('.autocomplete').autocomplete({
source: ['value1','value2','value3','value4'], //my source
select: function(event, ui){
event.stopPropagation(); //the select event will work next time you click
//your logic comes here ...
}
})
It worked for me, I hope it works for you! =)