【发布时间】:2014-06-24 05:23:50
【问题描述】:
我正在使用 Bootstrap Select (http://silviomoreto.github.io/bootstrap-select/) 为我的网站的每个部分显示带有 Font-Awesome 图标的下拉菜单。
我添加了添加新部分的功能 - 单击添加按钮时,会添加一个新部分(与上一部分重复)。在本节中,Bootstrap Select 不起作用。
我尝试像这样重新初始化它:
var select = $('[name="section['+ numbersection +'][section_icon]"]');
$(select).selectpicker('destroy');
$(select).selectpicker({
showIcon: false
});
但这不起作用,因为 detroy 方法似乎没有触发。有没有办法在动态添加的元素上重新初始化 Bootstrap Select?
【问题讨论】:
标签: jquery twitter-bootstrap select bootstrap-select