JSFiddle - React, Tailwind, and code Playground

by no1uknow

HTML

<script src="http://static.jstree.com/v.1.0rc2/jquery.jstree.js"></script>
<button id="simulate">Simulate click!</button><br/><br/>

<div id="tree">
    <ul>
        <li id="node_a"><a>Node A</a></li>
        <li id="node_b">
            <a>Node B</a>
            <ul>
                <li><a>Node C</a></li>
                <li><a>Node D</a></li>
            </ul>
        </li>
    </ul>
</div>

JavaScript

jQuery("#tree").jstree({plugins: [ "html_data", "types", "themes" ]});

$('#simulate').click(function() {
    // toggle_node, or open_node, or close_node
   $('#tree').jstree('toggle_node', '#node_b');
});