I've a tree menu. The last <li>
element from this menu contains an <a>
element.
I'm using the jQuery toggle()
method.
I know that toggle()
contains an e.preventDefault()
by default.
What I wanna do is give back the click event to the <a>
element.
Could you pls help?
HTML:
<ul class="menu">
<li>
Item1
<ul style="display: none">
<li>
subItem1
<ul style="display: none">
<li>
<a href="http://www.google.com">Google</a>
</li>
<li>
<a href="http://www.yahoo.com">Yahoo</a>
</li>
<li>
<a href="http://www.facebook.com">Facebook</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
Javascript:
$(".menu li").toggle(
function() {
$(this).children().slideDown();
},
function() {
$(this).children().slideUp();
}
);
Please check this fiddle: http://jsfiddle.net/fzy48/