<div id="navcontainer">
 <ul id="navlist">
   <li><a href="#" id="current">Item one</a></li>
   <li><a href="#">Item two</a></li>
   <li><a href="#">Item three</a></li>
   <li><a href="#">Item four</a></li>
   <li><a href="#">Item five</a></li>
 </ul>
</div>

This is my code for menus. How to hide "Item two, three, four, five", If "Item one" is clicked (using jquery)?

Member Avatar for stbuchok

Haven't tested it, but it should work.

$('#navlist li').click(function(){
    $('#navlist li').hide();

    $(this).show();
});
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.