Skip to content

Instantly share code, notes, and snippets.

@iwill
Last active September 4, 2015 12:14
Show Gist options
  • Save iwill/320652 to your computer and use it in GitHub Desktop.
Save iwill/320652 to your computer and use it in GitHub Desktop.
$.addEventType & $.fn.addEventType
/*!
* jQuery plugin - jquery.addEventType.js v1.0
* http://github.com/iwill/
*/
(function($) {
$.addEventType = $.fn.addEventType = function(eventType) {
(this.fn || this)[eventType] = function(handler) {
return handler ? this.bind(eventType, handler) : this.trigger(eventType);
};
return this;
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment