需要jquery.tokeninput [英] jquery.tokeninput required
本文介绍了需要jquery.tokeninput的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个很棒的小插件,但是我需要要求至少选择一个名称.我通常使用jquery.validate.但是,验证插件似乎无法在使用tokeninput的字段上工作.有人有答案吗?与往常一样,非常感谢您的帮助.
I have this fantastic little plugin working but I need to require that at least one name be selected. I normally use jquery.validate. However, the validation plugin does not appear to work on a field using the tokeninput. Does anyone have an answer? As always, thanks so much for your help.
$("#NewMessage").validate({
rules: {
name: {
required: true
}
}
});
$("#name").tokenInput("lookup.cfc?method=getNames&returnFormat=json", {
hintText: "Type in the name of recipient(s)",
noResultsText: "No results",
searchingText: "Searching..."
})
推荐答案
我遇到了相同的问题,并解决了覆盖忽略问题(显然,问题是tokenInput隐藏了原始输入,默认情况下,"validate"不验证隐藏的输入)
I had the same issue and solved it overriding ignore (apparently the problem is that tokenInput hides the original input and by default "validate" doesn't validate hidden inputs)
$("#NewMessage").validate({
ignore: "",
rules: {
name: {
required: true
}
}
});
这篇关于需要jquery.tokeninput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文