Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Created October 23, 2015 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubysolo/bf69886785ac60e2bdb0 to your computer and use it in GitHub Desktop.
Save rubysolo/bf69886785ac60e2bdb0 to your computer and use it in GitHub Desktop.
delegated binding
<div>
<button id="the-button">Hey</button>
</div>
<script>
$(document).on('click', '#the-button', function(e) {
// handler is bound to document, but only fires if event originated from #the-button
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment