css: ztree & treeSelect
1 2 | < link rel = "stylesheet" type = "text/css" media = "all" href = "ztree/css/zTreeStyle.css" /> < link rel = "stylesheet" type = "text/css" media = "all" href = "core/treeSelect.css" /> |
js: jquery,ztree,treeSelect
1 2 3 4 | < script src = "ztree/js/jquery.ztree.all.min.js" ></ script > <!--treeSelect--> < script src = "core/treeSelect.js" ></ script > |
定义一个class为"treeSelect"的div,并设置宽度,也可使用百分比
1 | < div ></ div > |
参数data为:ztree所需数据,需遵守ztree数据格式,demo.html中有,具体ztree数据格式可在treeSelect.js的142行"setting"处修改
inputId为生成代买中input的id,自定义方便取值(相当于select下拉选中的值)
1 2 3 4 5 6 | $( function () { $( ".treeSelect" ).treeSelect({ data:data, inputId: "txt" }) }); |