link1 link2 //jquery $(\"#div1 a\").click(function(){ var text = $(
Inside the click handler, this refers to the element which triggered the handler execution :
this
$("#div1 a").click(function(){ var text = $(this).text(); });
Use this :