Jquery 下拉树下面是一个使用Combotree组件的简单案例:
1、html
<!DOCTYPE html> <html> <head> <title>Combotree使用案例</title> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/jquery-combotree/dist/jquery.combotree.min.css"> </head> <body> <select id="combotree"></select> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-combotree/dist/jquery.combotree.min.js"></script> <script src="script.js"></script> </body> </html>
2、javascript
$(document).ready(function() {
// 初始化Combotree
$('#combotree').combotree({
data: [
{
id: 1,
text: 'Node 1',
children: [
{
id: 11,
text: 'Node 1.1'
},
{
id: 12,
text: 'Node 1.2'
}
]
},
{
id: 2,
text: 'Node 2'
}
],
multiple: true, // 允许多选
cascadeCheck: true // 级联选择
});
});
转自:chatGPT

浙公网安备 33010602011771号