gpt4 book ai didi

jquery - 如何将类添加到 bootstrap-tagsinput 生成的输入元素

转载 作者:行者123 更新时间:2023-12-01 04:02:59 31 4
gpt4 key购买 nike

我尝试了 the other post 中建议的解决方案:

$("input[name='tags']").tagsinput('input').addClass('form-control');

但是我得到了:

Uncaught TypeError: $(...).tagsinput(...).addClass is not a function

我也绑了:

$("input[name='tags']").tagsinput({
tagClass: 'form-control'
});

但仍然无法添加form-control

有什么想法吗?谢谢。

最佳答案

我在这里也遇到了同样的问题Bootstrap Tags Input, assign class to tags based on ajax call .

我尝试了一种奇怪的方法。在 DOM 中,标签存储在“标签”类中。所以我使用简单的 jQuery 选择器来实现这一点:

 $("span.tag:contains("+event.item+")").addClass('label-success');

关于jquery - 如何将类添加到 bootstrap-tagsinput 生成的输入元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36539120/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com