簡體   English   中英

使用Select2禁用自動完成輸入

[英]disabled input for autocomplete using Select2

我正在使用SELECT2執行自動完成

<select  class="js-example-basic-single" id="existeField">
    <option value="" disabled selected>Selectionnée le
                                    champs</option>
    <option th:each="fields: ${listFields}" th:value="${fields.id}"
        th:data-jira="${fields.idJira}" th:data-type="${fields.type}"
        th:data-defaut="${fields.value}" th:text="${fields.nom}">
   </option>
</select> 



<script>
    $(document).ready(function() {
        $(".js-example-basic-single").select2();   

    });
</script>

而且它禁用了輸入,設計也不是很好

在此處輸入圖片說明

問題不在SELECT2而是在模態中(這是標准的引導程序模態)

模態

  <div class="modal fade" id="exampleModal" name="exampleModal"
                tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                aria-hidden="true">
                <div class="modal-dialog" role="document">

  ....

解決方案是簡單地刪除tabindex="-1" ,一切都會好起來的

希望威爾能幫上忙。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM