Skip to content

Instantly share code, notes, and snippets.

@mikeyjk
Created February 3, 2016 12:35
Show Gist options
  • Save mikeyjk/a991258453141d9c2115 to your computer and use it in GitHub Desktop.
Save mikeyjk/a991258453141d9c2115 to your computer and use it in GitHub Desktop.
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment