mici37000
mici37000

Reputation: 141

Select node in jstree plugin on page load

I'm using JsTree jQuery plugin in order to create an organizational structure on my web page. The problem is when the page loads, the DOM of the HTML consists only of the root level of the tree (for some reason this is the way this plugin works). Therefore when I try to make some node selected with "select_node" function it doesn't recognize it because he isn't loaded into the DOM.

orgStructure.jstree('select_node', $('[data-value=101383]'), true);

This is the line of code that suppose to select the node.

Upvotes: 1

Views: 1050

Answers (1)

Kartikeya Khosla
Kartikeya Khosla

Reputation: 18873

Just wrap your jstree code inside $(document).ready(function(){})

Upvotes: 1

Related Questions