problem with the drop down menu with jquery
Posted
by
amir
on Stack Overflow
See other posts from Stack Overflow
or by amir
Published on 2011-02-02T15:19:39Z
Indexed on
2011/02/02
15:26 UTC
Read the original article
Hit count: 161
jQuery
Hi
Basically I have some links which include some other links, I'm trying to show the parent links only and when one clicks on the parent link the child links should appear and when one clicks on the parent link again the child link should disappear,
the code works for the first click and it opens the relevant child links but how do I make them disappear when I click on the parent link again,
thanks for the help.
jQuery.noConflict();
jQuery(document).ready(function(e) {
jQuery('.nav-container ul.level0 li.level1 a').click(function(e) {
e.preventDefault();
jQuery(this).css({'background':'#000000','color':'#ffffff'});
jQuery('.nav-container ul.level0 li.level2 a').css('display','block');
});
});
© Stack Overflow or respective owner