I am using JQuery. I have problem when Alerts the IDs of List shows two times, instead of once.
The list:
<ul id="testnav">
<li> <a href="#">Page 1</a></li>
<li> <a href="#">Page2..</a>
<ul id="subnav">
<li id="content_1"><a href="#"> Page3</a></li>
</ul>
</li>
</ul>
The code:
$("li").click(function(){
var current_id=$(this).attr('id');
alert(current_id);
// these alert two times one is empty another one is content_1
});
Any one explain why the code alerts two times? How do I make it execute a single time?