asp.net mvc 5 - jsTree jquery plugin is not working in mvc 5? -
trying use jstree in asp.net mvc 5 project. not figure out why not working? here fiddle link well. https://dotnetfiddle.net/24h7nm.
controller:-
public actionresult showtree() { return view(); }
view:-
@{ viewbag.title = "showtree"; } <link href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.1.0/themes/default/style.min.css" rel="stylesheet" /> <script> $(function () { $("#divtree").jstree(); }); </script> <h2>showterms</h2> <div id="divtree"> <ul> <li> root node 11 <ul> <li id="child_node_1">child node 1</li> <li>child node 2</li> </ul> </li> <li>root node 2</li> </ul> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.1.0/jstree.min.js"></script> <script src="~/scripts/app.js"></script>
you trying use $
before jquery available. move <script>
block down, so:
@{ viewbag.title = "showtree"; } <link href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.1.0/themes/default/style.min.css" rel="stylesheet" /> <h2>showterms</h2> <div id="divtree"> <ul> <li> root node 11 <ul> <li id="child_node_1">child node 1</li> <li>child node 2</li> </ul> </li> <li>root node 2</li> </ul> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.1.0/jstree.min.js"></script> <script src="~/scripts/app.js"></script> <script> $(function () { $("#divtree").jstree(); }); </script>
Comments
Post a Comment