select2基本用法及步驟以及輸入框無法獲取焦點問題


select2地址:https://select2.github.io/examples.html

1.引入select2相關文件包括css,js

2.在select 標簽內 class="js-example-basic-single"

3.<script>

  $('.js-example-basic-single').select2({

  //具體參考select2的api不多舉例

  language: 'zh-CN',

  minimumInputLength: 1, // 至少輸入n個字符,才去加載數據;若設置為0,則點擊選擇框,不用輸入內容,就去加載數據;默認為0

  maximumInputLength: 100, // 限制最大字符

});

</script>

4.個人在使用之后出現了輸入框無法獲取焦點不能輸入解決辦法:

在js里加上  $.fn.modal.Constructor.prototype.enforceFocus = function () { };


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM