I need to validate multiple text-boxes, which share a common name
Example
<input type="text" name="value[]" />
<input type="text" name="value[]" />开发者_JAVA技巧
<input type="text" name="value[]" />
How can I validate each and every text box, using jQuery? I am using jQuery Validation Plugin
Please help
To validate fields named with brackets you'll have to quote the name when setting up the rules for the plugin, like this:
$("#form").validate({
rules: {
"value[]": "required"
}
});
Hope this works for you, if it doesn't please try to specify the rules you want to validate.
try to use this
<script type="text/javascript">
$("#form_id").validate({
rules: {
"value[]":{
required: true
}
},
messages: {
setting: '<br>'+"Required Field"+''
}});
</script>
精彩评论