javascript - jquery: How do i set First "child" visible in Tree? -


in tree i'm trying make "child visible when page loads it's not working please me out on this...

$('.tree li:first').show();  

this make parent visible while want visible it's direct childs jsfiddle link

apply class direct child like,

<li class="child"><a href="#">child</a></li> 

java script code:

$(function () {     $('.tree li').hide();         $('.tree li:first').show();     $('.child').show();     $('.tree li').on('click', function (e) {         var children = $(this).find('> ul > li');         if (children.is(":visible")) children.hide('fast');         else children.show('fast');         e.stoppropagation();     }); }); 

see : demo


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -