I have a situation where I have a navigation menu that's a series of <ul>
lists, the first <li>
of which is a tab. I want to make the entire <li>
clickable instead of the <a>
tag inside the tab. So for example:
<ul id="home">
<li id="navtab">
<a id="home-link" onclick="doHome();">HOME</a>
</li>
</ul>
And the anchors are being created dynamically, so I need to keep this structure. So I'm trying to suss out how to capture the click event at the <li>
level, fire the onlick on the <a>
tag WITHOUT then re-firing the click at the <li>
level and causing recursion.
I'm using jQuery, but that's not necessary in the answer, or even relevant.
I've already tried adding e.stopPropagation() and preventDefault without positive result.