Homer_J
Homer_J

Reputation: 3323

jsTree - return node value

I have the following code:

for (i = 0, j = data.selected.length; i < j; i++) {
       r.push(data.instance.get_node(data.selected[i]).text.trim());
}
 alert('Selected: ' + r.join(', '));

This correctly brings back the text of the node but I'd like to also bring back the Node value as well - I have tried various forms of:

r.push(data.instance.get_node(data.selected[i]).id());
r.push(data.instance.get_node(data.selected[i]).val());

But no joy - any suggestions welcomed.

Upvotes: 0

Views: 196

Answers (1)

Biby Augustine
Biby Augustine

Reputation: 425

Try this

$.jstree.reference(data.reference).get_node(data.reference)

It will return you the jsTree node.

Upvotes: 1

Related Questions