JSFiddle - React, Tailwind, and code Playground

by mmeah

HTML

<script src="http://static.jstree.com/v.1.0rc2/jquery.jstree.js"></script>
<div id="demo1"></div>

<BR>Alerts:<div id="myAlert"></div>

JavaScript

var jData = [{
        "data": {
            "attr": {
                "title": "A node"               
            },
            "title" : "A node"
            },

            "children": [{
                "data": {
                    "title": "child"
                },
                "children": [{
                    "data": {
                        "title": "Grand Child"
                    }
                }]
            }]
        }];

        var myTree = $("#demo1").jstree({
            "json_data": {
                "data": jData
            },          
            "plugins": ["json_data", "ui", "themes"]
        }).bind("select_node.jstree", function(evt, data) {
            $("#myAlert").html("selected!");
        }).bind("deselect_node.jstree", function(evt, data) {
            $("#myAlert").html("deselected!");
        });