3

私は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
4

3 に答える 3

6

例の作業デモ:JSFiddle1およびJSFiddle2

参照とそれをどのように呼んでいるかを確認してください。このツリーは、探しているものとまったく同じである必要があります。

すべてのドキュメントのソースはここにあります:http ://www.jstree.com/

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

下記のファイルを含めてください。こちらのデモをご覧ください。

<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>
于 2012-04-27T07:22:07.400 に答える
2

ブラウザがjstree.jsを正しくロードしていないようです。

次の行を変更することで、jqueryがロードされているのと同じように、CDN(コンテンツ配信ネットワーク)からjstree.jsをロードしてみることができます。

<script type="text/javascript" src="jquery.jstree.js"></script> 

<script type="text/javascript" src="http://cachedcommons.org/cache/jquery-jstree/1.0.0/javascripts/jquery-jstree-min.js"></script> 
于 2012-04-27T07:16:08.983 に答える
0

あなたのコードは関数にアクセスできないようですjstree()。jstree.jsへのパスに何か問題があるのではないでしょうか。

<script type="text/javascript" src="jquery.jstree.js"></script>
于 2012-04-27T07:16:56.793 に答える