jsTree in this jsfiddle旁边有一个div(id = div2),但是当页面显示时div不存在。如果检查DOM(带有Inspect Element),div元素就会消失。这段代码出了什么问题?
HTML:
<div id="treediv" />
<div id="div2" style="width:30px;height:30px;background-color:orange" />
Javascript:
var tree = [
{ "data" : "Node1" },
{ "data" : "Node2" },
{ "data" : "Node3" },
{ "data" : "Node4" },
{ "data" : "Node5" }
];
$("#treediv").jstree({
"json_data" : { "data" : tree },
"plugins" : [ "json_data", "ui"]
});
答案 0 :(得分:0)
HTML错误,<DIV />
无效,应为<DIV></DIV>
例如:
<div id="treediv"></div>
<div id="div2" style="width:30px;height:30px;background-color:orange" ></div>