我直接使用时,后台一直报Uncaught Can't add objects when itemValue option is not set错误,

代码如下:

<div>
    <input  />
</div>

  

        $("#uploadFiles").tagsinput({
            itemValue: 'id',
            itemText: 'text',
        });
        
        var test={id:'adfa',text:'fff'};
        
        $("#uploadFiles").tagsinput('add', test);

查了半天,没找到问题所在,后来在stackoverflow发现一个相同的错误的帖子:

http://stackoverflow.com/questions/31926025/bootstrap-tagsinput-cant-add-objects-when-itemvalue-option-is-not-set

给了我启发,原来是写了data-role="tagsinput"属性,去掉后就OK啦

相关文章:

  • 2021-06-13
  • 2021-08-07
  • 2022-12-23
  • 2021-09-04
  • 2021-06-06
  • 2021-08-23
  • 2021-05-31
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
  • 2022-01-09
  • 2022-01-26
  • 2021-05-21
相关资源
相似解决方案