Bootstrap Select-在动态添加的元素上重新初始化 [英] Bootstrap Select - reinitialize on dynamically added element

查看:1352
本文介绍了Bootstrap Select-在动态添加的元素上重新初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Bootstrap Select( http://silviomoreto.github.io/bootstrap-select/),以在我的网站的每个部分中显示带有超赞"图标的下拉菜单.

I'm using Bootstrap Select (http://silviomoreto.github.io/bootstrap-select/) for displaying dropdown with Font-Awesome icons for each section of my website.

我增加了添加新部分的功能-单击添加"按钮时,将添加一个新部分(与先前部分重复).在本节中,引导选择不起作用.

I added ability to add new sections - when clicked on add button, a new section (duplicate of previous section) is added. In this section, the Bootstrap Select doesn't work.

我试图像这样重新初始化它:

I tried to reinitilize it like:

var select = $('[name="section['+ numbersection +'][section_icon]"]');
$(select).selectpicker('destroy');
$(select).selectpicker({
  showIcon: false
});

但这不起作用,因为detroy方法似乎不起作用.有没有办法在动态添加的元素上重新初始化Bootstrap Select?

That doesn't work though, as the detroy method doesn't seem to fire. Is there a way to reinitilize Bootstrap Select on dynamically added element?

推荐答案

您必须按照 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆