JQuery

Simple Jquery script to toggle the child of a list

Posted on Updated on

This is a simple jquery script to toggle the child of a list. This might to useful to browse hierarchial categories.
This script shows the top level list items at the start and hides all the child lists. Click a list item, and the child items show up in a nice easy scroll animation 🙂

Here is the js

function hideAll(){
jQuery('.hunting-places-list ul').hide();

}
jQuery(document).ready(function(){
hideAll();
jQuery('.hunting-places-list li a').click(function(){
jQuery(this).siblings().toggle('slow');
});
});

And here is a sample list

Hope this was useful to you. Thankx for reading 🙂
Cheers!!!