JQuery multiselect的相關使用

來源:互聯網
上載者:User

標籤:

這兩天做項目需要用到多選控制項,於是選擇了JQuery  multiselect控制項,介紹一下常用的一些相關屬性。

詳細地址:http://davidstutz.github.io/bootstrap-multiselect

添加引用:

頁面:

<div class="mui-input-row">       <span class="mui-icon mui-icon-contact mui-pull-right"></span>       <label style="color: #8f8f94;font-size: 15px !important">跟&nbsp;蹤&nbsp者</label>        <select id="example-getting-started" multiple="multiple">                @foreach (var emp in (List<SelectListItem>)ViewBag.unEmpList)                   {                        <option value="@emp.Value">@emp.Text</option>                     }          </select></div>

JS:

$(document).ready(function () {            $(‘#example-getting-started‘).multiselect({                 nonSelectedText: ‘請選擇跟蹤者‘,    //預設                filterPlaceholder: ‘搜尋‘,          //搜尋方塊內顯示                nSelectedText: ‘ 位跟蹤者‘,                             enableFiltering: true,                includeSelectAllOption: true,       //是否自耦的                selectAllText: ‘全選/全否‘,                allSelectedText: ‘已選中所有人員‘,                maxHeight: 400,                     //最大高度                dropUp: true,                       //控制項是否朝上搜尋             });            //取值  直接用 .val()就能取得多選中的值             var result = $(‘#example-getting-started‘).val();            // 設定預設值  注意格式            var ids = [1, 2, 3, 4, 5];            $(‘#example-getting-started‘).val(ids);             $(‘#example-getting-started‘).multiselect("refresh");        });

:

 

JQuery multiselect的相關使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.