如何将htmlselect转换成bootstrapselect?

how to convert html select to bootstrap select?

我在我的 Web 应用程序中使用 Bootstrap 并且是新手。我有一个关于如何将普通 html select 转换为 bootstrap select.

的问题

我需要在呈现整​​个页面后使用 ajax 使用 bootstrap select 填充 div,但是 select 我返回了是正常的 html select。我尝试调用selectPicker的render,refresh方法将其渲染为bootstrapselect,但是没有成功See my normal html select

如果有人能帮助我,我将不胜感激。谢谢。

在 ajax 调用中附加 select 元素 HTML 后添加此脚本。

$('#form-SchemeUUID').selectpicker({
  style: 'btn-info'  
});

还要确保插件的 CSS 和 Js 文件已添加到页面中。

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script>