How can I get the text inside the anchor tag in jquery
<div id="div1"> <a herf="#">link1</a> <a href="#">link2</a> </div> //jquery $("#div1 a").click(function(){ var text = $("#div1 a").text(); });
on the above tags, I want the text aside to be the anchor tag that I clicked on it, but clicking on each of the above anchor tags gives me the same answer ("link1link2"), how can I get "link1" when I click on the first tag and get "link2" when I click on the second anchor tag, that anchor tags can be infinite
+4