admin管理员组文章数量:1390192
I have this multiple select:
<select id="sel_dest" name="dest_var[]" multiple disabled="disabled" size="10">
<option value="" selected>Destinatario</option>
<option value="1"> .........
</select>
how can i validate (required field) this select with jquery validation plugin?
this code doesn't work:
$("#register_form").validate({
rules: {
dest_var: {
required: true;
}
}
});
I have this multiple select:
<select id="sel_dest" name="dest_var[]" multiple disabled="disabled" size="10">
<option value="" selected>Destinatario</option>
<option value="1"> .........
</select>
how can i validate (required field) this select with jquery validation plugin?
this code doesn't work:
$("#register_form").validate({
rules: {
dest_var: {
required: true;
}
}
});
Share
Improve this question
edited Aug 5, 2010 at 14:38
MvanGeest
9,6614 gold badges42 silver badges41 bronze badges
asked Aug 5, 2010 at 14:27
OmegaOmega
9,2089 gold badges31 silver badges29 bronze badges
3 Answers
Reset to default 3Simply use a required
class for the select tag.(and remove the []
in the id)
<select id="sel_dest" name="dest_var" class="required" multiple disabled="disabled" size="10">
<option value="" selected>Destinatario</option>
<option value="1"> .........
</select>
script:
$("#register_form").validate();
"dest_var[]" : {required: true}
You can see how to do it on the this example page.
rules: {
dest_var: {
required: true,
rangelength:[2,3]
}
}
本文标签: javascriptMultiple Select validation with jqueryStack Overflow
版权声明:本文标题:javascript - Multiple Select validation with jquery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744659835a2618177.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论