Skip to content

Instantly share code, notes, and snippets.

@philsinatra
Created January 3, 2013 13:13
Show Gist options
  • Save philsinatra/4443377 to your computer and use it in GitHub Desktop.
Save philsinatra/4443377 to your computer and use it in GitHub Desktop.
In jQuery event.target always refers to the element that triggered the event, where ‘event’ is the parameter passes to the function. http://docs.jquery.com/Events_(Guide)
$(document).ready(function() {
$("a").click(function(event) {
alert(event.target.id);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment