jsTree不工作 [英] jsTree not working

查看:96
本文介绍了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-compatiblecontent =ie = edge>
< meta name =descriptioncontent =>
< title>
BLA BLA
< / title>
< base href =/>
< meta name =viewportcontent =width = device-width,initial-scale = 1.0>
<! -
< link rel =stylesheethref =css / styles.css>
- >
< script type =text / javascriptsrc =http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js> < /脚本>
< script type =text / javascriptsrc =jquery.jstree.js>< / script>
< script type =text / javascript>
$(document).ready(function(){
$(#selector)。jstree();
});
< / script>
< / head>
< body>
< div id =selector>
< ul>
< li>< a>小组A的项目< / a>
< ul>
< li>< a>迭代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>迭代2< / a>
< ul>
< li>< a> Story D< / a>< / li>
< / ul>
< / li>
< / ul>
< / li>
< / ul>
< / div>
< / body>
< / html>

没有任何东西可以工作。
我得到以下错误:

  $(#selector)。jstree不是函数


解决方案

示例的演示: JSFiddle1 JSFiddle2



请检查参考资料以及如何调用它。这棵树应该和你正在寻找的一模一样。

休息所有文件的来源可以在这里找到: http://www.jstree.com/

 < script type =text / javascriptsrc = 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'>< /脚本> 

< link rel =stylesheettype =text / csshref =/ css / normalize.css>
< link rel =stylesheettype =text / csshref =/ css / result-light.css>

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


I am new to jQuery and jsTree and I am not sure why I can't get it working? Using this tutorial: http://tkgospodinov.com/jstree-part-1-introduction/

And this 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>

Nothing seems to work. I get the following error:

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

解决方案

Working demo of your example: JSFiddle1 and JSFiddle2

Please check the reference and how you are calling it. This tree should be exactly the same as what you are looking for.

Rest the source of all the documentation can be found here: http://www.jstree.com/

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

Include the files mentioned below. See 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>

这篇关于jsTree不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆