Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am new for the jstree, I wrote a very simple html below and it uses ul to create a list, I don't know why it's not showing the treeview when I run it, what am I missing? Please help me.

HTML
<!DOCTYPE html>
<html>

<head>
 <script src="./HTML/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="./HTML/jstree.js") type="text/javascript"></script>
    <script src="./HTML/jstree.min.js" type="text/javascript"></script>
   <link href="./HTML/style.min.css" rel="stylesheet" type="text/css" />

</head>

<body>

This is a try,,,,

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

<script src="./HTML/jquery.js"></script>

<script type="text/javascript">
     $(function () {
  $("selector").jstree();
});
</script>


</body>

</html>
Posted
Comments
Sampath Lokuge 24-Mar-14 17:10pm    
Do you have further issues about this or what?

Your code snippet is having number of issues.

1. You don't need to use both .min and not min versions of js and css files.So use one of them.For dev it's better use not min version.You can use .min for production.

2. $("selector").jstree(); is wrong.It should be as $("#selector").jstree();

3. This line '<script src="./HTML/jquery.js"></script>' is not required,hence you have already loaded the js file on your header section.

4. Check whether is there any other errors on your JS file by using Chrome dev tools.

Please read the below mentioned article for more info.

What is jsTree?

Note : Click the Over View Tab of the above article.
 
Share this answer
 
v3
Thank you, Lokuge.

After I made correction to the file, it worked. I then move the code to ASP.NET MVC 3, I run into a error 'Microsoft JScript runtime error: Object expected', I googled it and didnot find a good solution, can you tell me what the problem is? Do you have url that I can use it in my prograion, instead of loading the javescript from my local folder? Thanks again.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900