“未为Select2未定义的错误定义查询函数” [英] "query function not defined for Select2 undefined error"
本文介绍了“未为Select2未定义的错误定义查询函数”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用Select2并在多个项目输入/文本字段上获取此错误:
Trying to use Select2 and getting this error on multiple item input/text field:
"query function not defined for Select2 undefined error"
推荐答案
问题是因为select2添加了额外的div。 Select2添加了带有select2-container form-select类的新div来包装创建的select。因此,下次加载函数时,由于select2被附加到div元素,因此抛出了错误。我更改了我的选择器......
The problem was because of the extra div that was being added by the select2. Select2 had added new div with class "select2-container form-select" to wrap the select created. So the next time i loaded the function, the error was being thrown as select2 was being attached to the div element. I changed my selector...
前缀select2 css标识符,具有特定的标记名称select:
Prefix select2 css identifier with specific tag name "select":
$('select.form-select').select2();
这篇关于“未为Select2未定义的错误定义查询函数”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文