Skip to content

Instantly share code, notes, and snippets.

@mpsenn
Last active December 19, 2015 02:39
Show Gist options
  • Save mpsenn/5884946 to your computer and use it in GitHub Desktop.
Save mpsenn/5884946 to your computer and use it in GitHub Desktop.
/*
* IE 7-9 don't trigger the onchange event when the user uses autocomplete.
* Extend the jQuery change event to fill in that trigger.
*/
(function($) {
// Keep the old change function around for later
var oldchange = $.fn.change;
$.fn.change = function(handler) {
// Register with jQuery to call the function like normal
var result = oldchange.apply(this, handler);
if(handler) {
// Just for text boxes, call this special function on blur
this.filter('input[type="text"]').blur(function(event) {
$(this).change(event);
});
}
return result;
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment