<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Tree View</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-treeview.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Bootstrap Tree View - DOM Tree</h1>
<br/>
<div class="row">
<div class="col-sm-12">
<label for="treeview"></label>
<div id="treeviews"/>
</div>
</div>
<div class="ol-sm-6">
<div class="input-group">
<span class="input-group-addon">所属部门</span>
<input type="text" id="depName" name="depName" class="form-control" value="" onclick="$('#treeview').show()" >
<input type="hidden" id="deptId" name="deptId" value="36">
</div>
<div id="treeview" style="display:none;"/>
</div>
</div>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/bootstrap-treeview.js"></script>
<script type="text/javascript">
function buildDomTree() {
var data = [];
function walk(nodes, data) {
if (!nodes) { return; }
$.each(nodes, function (id, node) {
var obj = {
id: id,
text: node.nodeName + " T_T " + (node.innerText ? node.innerText : ''),
tags: [node.childElementCount > 0 ? node.childElementCount + ' child elements' : '']
};
if (node.childElementCount > 0) {
obj.nodes = [];
walk(node.children, obj.nodes);
}
data.push(obj);
});
}
walk($('html')[0].children, data);
return data;
}
$(function() {
var options = {
bootstrap2: false,
showTags: true,
levels: 5,
showCheckbox:true,
checkedIcon:"glyphicon glyphicon-check",
data: buildDomTree(),
onNodeSelected:function(event, data){
$("#depName").val(data.text);
$("#treeview").hide();
}
};
$('#treeview').treeview(options);
});
</script>
</body>
bootstrap树形下拉框 下拉框树形菜单
4星 · 超过85%的资源 需积分: 50 139 浏览量
2016-11-15
11:33:46
上传
评论 10
收藏 129KB ZIP 举报
悬崖边
- 粉丝: 2
- 资源: 7
最新资源
- IMG_20240425_120538.jpg
- My Complete Genome_6k Base-Pairs of Phenotype SNPs_Complete Raw Data.zip
- qt 的mqtt测试demo
- 移动应用开发教程-zip.zip
- mosquitto-2.018-install-windows-x64
- FTPServer FTP 服务器,绿色免安装,单文件
- 梦畅语音点名软件,上课点名
- 利用ADNI数据集和标签,在tensorflow框架上使用tensorlayer接口,通过架构u-net实现海马体的分割
- Kutools for Word v9.0 office word 插件
- 修复Windows 10 LTSC 2021资源占用率高
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
前往页