$('a').click(function( e ) { alert(this.id);
This assigns a click event to all <a> elements that will alert its ID when clicked.
Uncomment the e.preventDefault() line to prevent the link from default behavior (after it href ).
It would probably be better to add a class attribute to the links and select with this:
$('a.someClass').click(function( e ) { alert(this.id);
This selects <a> elements with the class "someClass" using the class selector .
source share