开发者

Multiple Text Box Validation

开发者 https://www.devze.com 2023-02-06 23:56 出处:网络
I need to validate multiple text-boxes, which share a common name Example <input type=\"text\" name=\"value[]\" />

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

精彩评论

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