?

Log in

Originally published at Sara Trice. You can comment here or there.

The documentation for jsTree is thorough, but not particularly easy to read. If you are looking for an easy way to add “Expand All” and “Collapse All” buttons, here’s one way:

<input type="button" value="Collapse All" onclick="$('#tree_container_id').jstree('close_all');">
<input type="button" value="Expand All" onclick="$('#tree_container_id').jstree('open_all');">

where ‘#tree_container_id’ is, of course, the ID of the container node for your tree.

Comment Form

No HTML allowed in subject

   
 

Notice! This user has turned on the option that logs your IP address when posting. 

(will be screened)