-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree.html
More file actions
43 lines (40 loc) · 1.37 KB
/
tree.html
File metadata and controls
43 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jsTree test</title>
<!-- 2 load the theme CSS file -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<!-- 4 include the jQuery library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
<!-- 5 include the minified jstree source -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script>
$(function() {
$('#jstree').jstree();
$('#jstree').on("changed.jstree", function(e, data) {
console.log(data.selected);
});
$('button').on('click', function() {
$('#jstree').jstree(true).select_node('child_node_1');
$('#jstree').jstree('select_node', 'child_node_1');
$.jstree.reference('#jstree').select_node('child_node_1');
});
});
</script>
</head>
<body>
<!-- Tree Container -->
<div id="jstree" style="width:100%;border:5px groove;">
<!-- FileSystem -->
<ul>
<li>Root
<ul>
<li id="child_node_1">Child node 1</li>
<li>Child node 2</li>
</ul>
</li>
</ul>
</div>
</body>
</html>