本文介绍了下拉框/单选按钮验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用我的表单的jQuery工具(http://flowplayer.org/tools/demos/index.html)验证器,并想知道如何验证下拉列表和单选按钮?
I'm using the jQuery tools (http://flowplayer.org/tools/demos/index.html) validator for my form and was wondering how to validate dropdowns and radio buttons?
任何人都有实现它的经验?
Anyone had experience of implementing it?
推荐答案
在文档中,您还可以使用必需的= SELECT要素属性,但它也不适用于我。
我选择使用自定义验证器功能。希望这适合你。这是非常基本的,但它缺少一些其他的考虑,使其更加灵活。
In the documentation it says you can also use the required="required" attribute for SELECT elements, but it's not working for me either.I opted to use the custom validator function. Hope this works for you. It is pretty basic though, its missing some other considerations to make it more flexible.
$.tools.validator.fn("select[required=required]", function(input, value) {
// If the first item in the list is selected return FALSE
return !input[0].options[0].selected;
});
这篇关于下拉框/单选按钮验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!