开发者

Multiple Text Box Validation

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜