Find children
I have this html structure:
<ul class="shopp_categories"> <li><a href="#">TEXT</a> <ul class="children"> <li><a href="#">TEXT</a></li> </ul> </li> <li><a href="#">Text</a></li> <li><a href="#">TEXT</a> <ul class="children"> <li><a href="#">TEXT</a></li> </ul> </li> </ul>
This is my js code:
jQuery('#sidebar .shopp_categories ul.children').parent().prepend('<span class="sidebar_cats_more"></span>'); jQuery('.sidebar_cats_more').click(function(){ var $children_list = jQuery(this).find('ul').children().children(); alert($children_list.html()); $children_list.slideToggle(1000, function () { if ( $children_list.is(':visible') ) { } if ( $children_list.is(':hidden') ) { } }); });
I need to find a list of children from a list item, where
span.sidebar_cats_more
It was supposed. If I found this list, it should be animated using a slide tug. The problem is on this line:
var $children_list = jQuery(this).find('ul').children().children();
+4
2 answers