I'm new to jqTree. I am trying to use the function: getSelectedNode found here: jqTree functions I have my tree working and being displayed using my own data as well as the sample data within this function:
$(function() {
$('#tree1').tree({
data: data,
dragAndDrop: true,
autoOpen: 1
});
});
Using the jqTree function below, I only ever get "null" out on loading the page. Furthermore nothing changes when I select a node.
var node = $('#tree1').tree('getSelectedNode');
console.log(node);
I have also tried the given sample:
var node = $tree.tree('getSelectedNode');
console.log(node);
In this case I get $tree not defined
Essentially, what am I doing wrong? How does these type of jqTree functions work? Tks !
It appears that you have to wrap this function in a click event. But of course, the docs don't tell you that. I found the source here: jqTree I htis helps someone else.
);