How can I get the id of the selected node in a jsTree?
function createNewNode() {
alert(\'test\');
var tree = $.tree.reference(\"#basic_html\");
select
Just use
var nodeId = $('#FaqTreeView').jstree().get_selected("id")[0].id;
where #FaqTreeView
is the id of your div that contains the jstree.
These are all old answers for old versions. As of version 3.3.3 this will work to get all attributes of the selected node.
$('#jstree').jstree().get_selected(true)[0]
If you then want the id then add .id at the end. You can look at all the other attributes in web developer tools if you copy the above code.