Hello. I have a treeview menu with variable levels. Only element on last level is clickable, the rest should have links "#". By default level 2 and 3 have links (links are created dynamically so I can't add them by jQ). If li level is 3, I need to change href for level 2 to "#" but I can't get it working :/
<ul id="Menu">
<li>
<span id="primary">
<h1>
<a href="#">Torby</a>
</h1>
</span>
<ul>
<li>
<span id="secondary">
<h2>
<a href="/category/category/bags_/">Torby</a>
</h2>
</span>
<ul>
<li>
<h3>
<a href="/category/category/shoulderbag/">Na Ramię</a>
</h3>
</li>
</ul>
</li>
</ul>
</li>
h2 href is what I'm after . I've tried sth like this :
$("Menu ul").has("h3"){
$(this).find("#secondary h2 a").attr("href","#");
};
This is how it looks :