Skip to content

Instantly share code, notes, and snippets.

@npearce
Created April 7, 2020 20:43
Show Gist options
  • Save npearce/6a8947d0884dac33c1d23353aa236e73 to your computer and use it in GitHub Desktop.
Save npearce/6a8947d0884dac33c1d23353aa236e73 to your computer and use it in GitHub Desktop.
JQuery event best practices
// One does this to be happy:
$(document).on('click', '#some_id', () => {
// Something
})
// One does this to be sad
$('#some_id').click(() => {
// Something
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment