Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SergeiGolos/6cdbabd5767c414252f7 to your computer and use it in GitHub Desktop.
Save SergeiGolos/6cdbabd5767c414252f7 to your computer and use it in GitHub Desktop.
Implementation of a dispose function for bootstraps typeahead control.
(function (typeahead) {
'use strict';
typeahead.prototype.dispose = function () {
if (this.eventSupported('keydown')) {
this.$element.off('keydown');
}
this.$element.off('focus').off('blur').off('keypress').off('keyup');
this.$element = null;
this.$menu.off('click').off('mouseenter').off('mouseleave');
this.$menu = null;
}
})($.fn.typeahead.Constructor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment