jquery:how to get the id of anchor tag
Posted
by balalakshmi
on Stack Overflow
See other posts from Stack Overflow
or by balalakshmi
Published on 2010-04-16T05:25:38Z
Indexed on
2010/04/16
5:33 UTC
Read the original article
Hit count: 340
jQuery
I have 2 anchor tags
<li><a id="tab1" href="#tabs-1">Issue</a></li>
<li><a id="tab2" href="#tabs-2">Change Request</a></li>
I have the following jquery:
$('a').click(function(event) {
alert($('a').attr("id"));
});
What happens: I always get "tab1" in the pop up
What I need: when user clicks on an anchor tag, its id needs to be displayed in the pop up
© Stack Overflow or respective owner