简体   繁体   English

如何激活加载DOM后添加的输入的bootstrap.tagsinput?

[英]How to activate bootstrap.tagsinput for inputs added after DOM loaded?

I'm dynamically adding some fields that I'd like to be tag fields. 我正在动态添加一些我想成为标签字段的字段。

I'm using bootstrap.tagsinput 我正在使用bootstrap.tagsinput

Any input s marked with data-role=tagsinput in the original document turn out just fine. 原始文档中任何标有data-role=tagsinput input可以。 However, if I add any more using jQuery for instance, 但是,例如,如果我使用jQuery添加更多内容,

How do I apply bootstrap.tagsinput to them? 如何将bootstrap.tagsinput应用于它们?

I just did: 我已经做了:

$('#input-tags').tagsinput('destroy');
$('#input-tags').tagsinput();

This worked without having to add and remove all tags. 这项工作无需添加和删除所有标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM