Skip to content

Instantly share code, notes, and snippets.

@hamidreza-s
Last active December 11, 2015 01:19
Show Gist options
  • Save hamidreza-s/4523015 to your computer and use it in GitHub Desktop.
Save hamidreza-s/4523015 to your computer and use it in GitHub Desktop.
Seems like they are equivalent in most cases, though "this" seems easier to type.
// 1, this
$('#selector').on('click',function(){
$(this)...
// do stuff with clicked element
})
// 2, e.currentTarget
$('#selector').on('click',function(e){
$(e.currentTarget)....
// do stuff with clicked element
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment