/ Published in: jQuery

Clicking on node makes it toggle between opened and closed. Nodes needs to have id attribute for this to work.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
.bind("select_node.jstree", function (event, data) { var id = data.rslt.obj.attr("id"); if (id != undefined) { if ($("li[id=" + id + "]").hasClass("jstree-open")) $("#treeViewContainer").jstree("close_node", "#" + id); else $("#treeViewContainer").jstree("open_node", "#" + id); } } <div id="treeViewContainer"> <ul> </ul> </div>
Comments
