jquery - jsTree 不工作

标签 jquery html jstree

我是 jQuery 和 jsTree 的新手,我不确定为什么我不能让它工作? 使用本教程: http://tkgospodinov.com/jstree-part-1-introduction/

还有这个 html/javascript:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <meta name="description" content="">
        <title>
            BLA BLA
        </title>
        <base href="/">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!--
        <link rel="stylesheet" href="css/styles.css">
        -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>
        <script type="text/javascript" src="jquery.jstree.js"></script>
        <script type="text/javascript">                                         
        $(document).ready(function() {
             $("#selector").jstree();
        });                                     
        </script>
        </head>
        <body>
            <div id="selector">
                <ul>
                    <li><a>Team A's Projects</a>
                        <ul>
                        <li><a>Iteration 1</a>
                            <ul>
                                <li><a>Story A</a></li>
                                <li><a>Story B</a></li>
                                <li><a>Story C</a></li>
                            </ul>
                            </li>
                        <li><a>Iteration 2</a>
                        <ul>
                            <li><a>Story D</a></li>
                              </ul>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </body>
</html>

似乎没有任何效果。 我收到以下错误:

$("#selector").jstree is not a function

最佳答案

示例的工作演示:JSFiddle1JSFiddle2

请检查引用以及您如何调用它。这棵树应该和你要找的完全一样。

其余所有文档的来源都可以在这里找到:http://www.jstree.com/

<script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.jstree.js"></script>

包括下面提到的文件。参见 demo here .

<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>

<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">

<script type='text/javascript' src="http://static.jstree.com/v.1.0pre/jquery.jstree.js"></script>

关于jquery - jsTree 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10346271/

相关文章:

jQuery UI slider 在使用时向上移动并消失在 div 中

html - CSS & HTML : Clutter elements when change floating

html - 删除 IE9 在 <img> 周围创建的神秘空间

javascript - 如何重绘树(jstree)

javascript - 使用 jquery 单击时将文本附加到 div 元素

javascript - 查看 json 并单击该 json 中的 links.json 并将其替换为当前的 json View

javascript - 无法使 javascript 下拉菜单正常工作

php - 具有两个提交按钮和两个不同操作的 HTML 表单

php - JavaScript(JsTree): How to reference subelements of tree nodes

jquery - 如何获取jstree中当前选定节点的文本?