使用flaskpython和bootstrap通过搜索栏选择

2024-05-12 20:35:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用bootstrap通过搜索栏进行选择,选择选项是从csv文件上传填充的,选项值是我使用python循环填充选项的文件列

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap- 
       select.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap- 
            select.min.css" rel="stylesheet" />

     <script>
         $(function() {
         $('.selectpicker').selectpicker();
            });
     </script>



           <select class="form-control selectpicker " id="exampleFormControlSelect1" name="choice" 
                              data-live-search="true">

                     {% for i in list_var %}
              <option value="{{ i }}" data-tokens="{{ i }}" {% if loop.first %} SELECTED{% endif %} > 
                          {{ i }}</option>
                     {% endfor %}

                  </select>

问题是我没有选择的余地

enter image description here

知道当我不使用selectpicker类时,它正常工作,我可以得到我的值

enter image description here


Tags: 文件httpssrccom选项jsscriptajax