Skip to content

Instantly share code, notes, and snippets.

@jonwolfe
Last active November 12, 2015 20:49
Show Gist options
  • Save jonwolfe/95370976b492feb57ccc to your computer and use it in GitHub Desktop.
Save jonwolfe/95370976b492feb57ccc to your computer and use it in GitHub Desktop.
# general event handler
$.e = (selector, eventName, callback) ->
$(document).on eventName, selector, (event) =>
el = $(event.currentTarget)
callback(event, el)
# click handler
$.click = (selector, callback) ->
$.e selector, 'click', callback
# example usage
$.click '[showmodal]', (e, el) ->
modal = $ el.attr('href')
show modal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment