JSFiddle - React, Tailwind, and code Playground
HTML
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<script type='text/javascript' src="http://static.jstree.com/v.1.0pre/jquery.jstree.js"></script>
<script type='text/javascript' src="http://static.jstree.com/v.1.0pre/jquery.hotkeys.js"></script>
<div id="testtree">
<ul>
<li id="1" title="ID:1"><a>Fruits and Vegetables</a>
<ul>
<li id="11" title="ID:11"><a>Fruit</a>
<ul>
<li id="111" title="ID:111"><a>Apple</a></li>
<li id="112" title="ID:112"><a>Banana</a></li>
</ul>
</li>
<li id="12" title="ID:12"><a>Vegetables</a>
<ul>
<li id="121" title="ID:121"><a>Zucchini</a></li>
<li id="122" title="ID:122"><a>Tomato</a>
<ul>
<li id="1221" title="ID:1221"><a>Red Tomato</a></li>
<li id="1222" title="ID:1222"><a>Green Tomato</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<button>Summary</button>
JavaScript
$(document).ready(function() {
var checked_ids = []; // list for the checked IDs
$("#testtree").jstree({
"plugins" : [ "themes", "html_data", "checkbox", "ui" ]
});
})
var button = document.querySelector( "button" );
// If the user clicks on the button, show him the IDs of the checked fruits/vegetables:
button.addEventListener( "click", function( ev ) {
var arr = new Array();
$("#testtree").jstree('get_checked').each(function(index) {
arr.push($(this).attr('id'));
});
alert( "Your Selection: "+arr.join());
}, false);