Reputation: 51
I have a ques about jquery jstree plugin. I need to create node with specific html. I know about how to add a new node with some name, but i don't know how to add named node with additional html tags
var ins_node = $('#jstree').jstree().create_node('#' + parent_node_id , { "id" : parent_node_id + up_cat_id, "text" : '<span>' + c_name_arr[c_name_arr.length - 1] + '</span>' }, "last", function(){});
$('#' + ins_node + '_anchor').append(cln_buttons);
cln_buttons
- is the JQuery object of HTML. When code is completed, the needed node successfully adding in tree with cln_buttons
. But when this code is repeated on the next time, HTML code previously added was removed.
Upvotes: 2
Views: 2689
Reputation: 3886
The safest way to add custom markup to jsTree is to build a simple plugin that does that for you.
You can look at example plugins here:
https://github.com/vakata/jstree/blob/master/src/misc.js#L147
Upvotes: 1