input框 select复选和单选,树形菜单供选择
XML/HTML Code
- <div class="container">
- <div class="row">
- <div class="col-lg-6">
- <h3>Multi Selection</h3>
- <input type="text" id="justAnInputBox" placeholder="Select"/>
- </div>
- <div class="col-lg-6">
- <h3>Single Selection</h3>
- <input type="text" id="justAnotherInputBox" placeholder="Type to filter"/>
- </div>
- </div>
- </div>
JavaScript Code
- <script type="text/javascript">
- var SampleJSONData = [
- {
- id: 0,
- title: 'choice 1 '
- }, {
- id: 1,
- title: 'choice 2',
- subs: [
- {
- id: 10,
- title: 'choice 2 1'
- }, {
- id: 11,
- title: 'choice 2 2'
- }, {
- id: 12,
- title: 'choice 2 3'
- }
- ]
- }, {
- id: 2,
- title: 'choice 3'
- }, {
- id: 3,
- title: 'choice 4'
- }, {
- id: 4,
- title: 'choice 5'
- }, {
- id: 5,
- title: 'choice 6',
- subs: [
- {
- id: 50,
- title: 'choice 6 1'
- }, {
- id: 51,
- title: 'choice 6 2',
- subs: [
- {
- id: 510,
- title: 'choice 6 2 1'
- }, {
- id: 511,
- title: 'choice 6 2 2'
- }, {
- id: 512,
- title: 'choice 6 2 3'
- }
- ]
- }
- ]
- }, {
- id: 6,
- title: 'choice 7'
- }
- ];
- var comboTree1, comboTree2;
- jQuery(document).ready(function($) {
- comboTree1 = $('#justAnInputBox').comboTree({
- source : SampleJSONData,
- isMultiple: true
- });
- comboTree2 = $('#justAnotherInputBox').comboTree({
- source : SampleJSONData,
- isMultiple: false
- });
- });
- </script>
原文地址:http://www.freejs.net/article_biaodan_760.html