Skip to content

Instantly share code, notes, and snippets.

@radist2s
Created November 27, 2013 06:08
Show Gist options
  • Save radist2s/7671362 to your computer and use it in GitHub Desktop.
Save radist2s/7671362 to your computer and use it in GitHub Desktop.
jQuery.eventSuffix = function(event, suffix){
if (!suffix){
return event
}
return jQuery.map(event.split(' '), function(i){
return i ? i + '.' + suffix : null
}).join(' ')
}
//Usage:
var submitEvent = $.eventSuffix('click keydown', 'myEventNamespace')
$('a').on(submitEvent, submitFunction)
$('a').off(submitEvent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment