2 var $tree = $('#tree1');
5 data: ExampleData.example_data,
7 onCreateLi: function(node, $li) {
8 // Append a link to the jqtree-element div.
9 // The link has an url '#node-[id]' and a data property 'node-id'.
10 $li.find('.jqtree-element').append(
11 '<a href="#node-'+ node.id +'" class="edit" data-node-id="'+ node.id +'">edit</a>'
16 // Handle a click on the edit link
20 // Get the id from the 'node-id' data property
21 var node_id = $(e.target).data('node-id');
23 // Get the node from the tree
24 var node = $tree.tree('getNodeById', node_id);
27 // Display the node name