how to write java script for expand and collapse particular parent of treeview when i click on the parent node... if one of parent node expand ,if i click on that it should be collopse,.... and if collapsed vics versa
+2
A:
It's as easy as:
<ul id="tree">
<li>
<span class="title">Title</span>
<ul>
<li><span class="title">Item 1</span></li>
<li><span class="title">Item 2</span></li>
<li><span class="title">Another item</span>
<ul>
<li><span class="title">another one</span></li>
</ul>
</li>
</ul>
</li>
</ul>
$(document).ready(function(){
$('#tree span.title').click(function(){
$(this).next().toggle();
});
});
When using jQuery.
Harmen
2010-02-20 12:40:01
i need in javascript!!
2010-02-20 12:47:56
jQuery is actually a Javascript library, which makes Javascript a little easier to write: http://jquery.com/
Harmen
2010-02-20 12:49:36
can u pls provide in javascript because im totally new in javascript as well treeview
2010-02-20 12:52:24