尝试使用一个简单的例子来获取jQuery树插件。 按照首页上的示例进行操作 http://www.jstree.com/
我收到的错误可能很简单,也可能是路径问题。但是,它发生在事件处理程序中。
Microsoft JScript运行时错误:对象不支持属性或方法' select_node'
<link rel="stylesheet" href="assets/jstree/themes/default/style.min.css" />
<script src="assets/jstree/jstree.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
//create tree instance
$('#jstree_demo_div').jstree();
// bind to events triggered on the tree
$('#jstree').on("changed.jstree", function (e, data) {
console.log(data.selected);
});
//interact with the tree
$('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>
<div id="jstree">
<!-- in this example the tree is populated from inline HTML -->
<ul>
<li>Root node 1
<ul>
<li id="child_node_1">Child node 1</li>
<li>Child node 2</li>
</ul>
</li>
<li>Root node 2</li>
</ul>
</div>
<button>demo button</button>