jsTree onSelect event
Update in 2018.
Thanks to @ProfK's comment, the API has changed in new version of jstree. In jstree v3.1.0 (or earlier), the API has changed to:
$("#treeContainer").on(
"select_node.jstree", function(evt, data){
//selected node object: data.node;
}
);
For jstree old version (before 2013).
You can get the selected node object and its text by:
$("#treeContainer").bind(
"select_node.jstree", function(evt, data){
//selected node object: data.inst.get_json()[0];
//selected node text: data.inst.get_json()[0].data
}
);
jstree new version for get text from node should use data.node.text
$("#treeContainer").on("select_node.jstree",
function(evt, data){
alert(data.node.text);
}
);