$ ("li"). click () applies the click event to all LIs on the page.
When you click
<li> <a href="#">Page2..</a>
<ul id="subnav">
<li id="content_1"><a href="#"> Page3</a></li>
</ul>
</li>
In fact, you click on the external LI and internal LI, which may cause the event to fire twice. The external LI has no identifier, so it is empty, and the internal LI has the identifier "content_1", so it is displayed.
It makes sense?
source
share