Category Archives: jQuery

How to handle the resets on loss of focus while using autocomplete combobox in IE?

You can try using the jQuery UI autocomplete’s open and close event to control your textbox’s blur event. When the autocomplete is open you disable the blur event and when it close you enable your blur event again.

var disable=false;

$( "#tags" ).autocomplete({
  source: availableTags,
  open: function(event, ui) { disable=true },
  close: function(event, ui) {
    disable=false; $(this).focus();
  }
}).blur(function() {
  if(!disable) {
    alert('blur');
  }
});

Instead of

alert('blur');

write the code that you need to workout when exactly the focus of the input filed is lossing.

I personly tested and used it.