0
我对jQuery和jsTree都很陌生,对html,CSS或Java Script也没有多少经验。现在,我试图以html列表格式设置一个小测试树。 这是我的HTML列表:第一次运行jstree
<div id="testtree">
<ul>
<li><a>Fruits and Vegetables</a>
<ul>
<li><a>Fruit</a>
<ul>
<li><a>Apple</a></li>
<li><a>Banana</a></li>
</ul>
</li>
<li><a>Vegetables</a>
<ul>
<li><a>Zucchini</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
这是我的代码:
<!doctype html>
<html>
<head>
<title>jstree test</title>
</head>
<body>
<script type="text/javascript" src="_lib/jquery.js"></script>
<script type="text/javascript" src="jquery.jstree.js"></script>
</body>
</html>
现在,我不知道哪里来的HTML列表插入代码,并在插入
$("#testtree").jstree();
我把所有jsTree文件放在与我的html文件(包括_demo,_docs和_lib)相同的文件夹中,而不仅仅是jquery.jstree.js文件。包含在jsTree安装包中的jQuery文件正在运行 - 我不确定我的代码是否有错,或者是否与jquery.jstree.js文件有关。 任何想法,我做错了将不胜感激!
编辑:看来,jstree没有正确加载中,我添加
alert($().jquery);
alert($().jquery.jstree);
的代码,并得到了版本号的jQuery(1.9.1),但“不确定”的jstree。
谢谢您的帮助。我需要把html列表放到哪里?编辑:明白了! – atreju
这并不能解决问题,小提琴也不能工作,它只是显示一个无序列表。 –