i trying select list id automatically using jquery. when click on list should take id , allow toggle. want jquery automatically gets id`` of clicked item , perform toggle.
by toggle mean when click on catalog other list items hide. , catalog list show.
i want implement below jquery :
**$("").click(function(){ $("").toggle(); });*
*
<div id="aside"> <div id="column"> <ul> <li id="dashboard"><a href=""> dashboard</a></li> <li id = "catalogs"><a href="#"> catalog</a> <div id="q"> <ul> <li><a href="">catogeries</a></li> <li><a href="">departure location</a></li> <li><a href="">return location </a></li> <li><a href="">cities </a></li> <li><a href="">vendor </a></li> <li><a href="">discount coupons</a></li> <li> <a href="">remaining seats </a></li> </ul> </div> </li> <li id="user"><a href="#"> users</a> <div id="g"> <ul> <li><a href="">customer</a></li> <li><a href="">admin</a></li> <li><a href="">agents</a></li> </ul> </div> </li> <li id="catalog"><a href="#"> customers</a> <div id="s"> <ul> <li><a href="">customer</a></li> <li><a href="">orders</a></li> <li><a href="">reward system</a></li> </ul> </div> </li> <li id="repot"><a href="#"> reports</a> <div id="k"> <ul> <li><a href="">monthly</a></li> <li><a href="">comission report</a></li> </ul> </div> </li> </ul> </div> </div>
$("#column li").click(function() { $('#column li li').hide(); $(this).find('li').show(); });
jsfiddle: http://jsfiddle.net/1qazzfxp/1/
or:
$("#column li").click(function() { $('#column li li').not($(this).find('li')).hide(); $(this).find('li').toggle(); });
jsfiddle: http://jsfiddle.net/1qazzfxp/2/
Comments
Post a Comment