首页 > 代码库 > 【ztree】ztree例子

【ztree】ztree例子

<script language="javascript" type="text/javascript" src="http://www.mamicode.com/js/jquery.js"></script><script language="javascript" type="text/javascript" src="http://www.mamicode.com/js/jquery.ztree.core-3.0.js"></script><link type="text/css" rel="stylesheet" href="http://www.mamicode.com/css/zTreeStyle/zTreeStyle.css" />

 

<ul id="tree" class="ztree"></ul>

 

$(document).ready(function(){    var Index = {        init:function(){            var setting = {                treeId:‘tree‘            };            var data =http://www.mamicode.com/ [                {id:1, pId:0, name: "父节点1"},                {id:11, pId:1, name: "子节点1"},                {id:12, pId:1, name: "子节点2"}            ];            var zTree = $.fn.zTree.init($("#tree"), setting, data); }, 
  }
  $(Index.init);
});

 

【ztree】ztree例子