jstree get the level of selected node
问题 How can I get the degree/level of the currently selected node? I.e. the number of parents it has. I have the section which executes on selection of a node as such: .bind("select_node.jstree", function (event, data) { var nodeInfo = $("#" + data.rslt.obj.attr("id")); console.log(data.rslt.obj.attr("id")); // the id of the node console.log(nodeInfo.children("a").text()); // the name of the node // the level of the node??? }); 回答1: data.inst.get_path().length 1 is root node; .bind("select_node