0

if I give index in input array then only required working other validation not working

<input type="text" name="batch_no[0]"> 
<input type="text" name="batch_no[0]"> 

   $( "#batch-form" ).each( function() {                
        $(this).validate({
            rules: {
                "batch_no[]": {
                    required: true,
                    minlength: 5,
                    maxlength: 20,
                    alphanumeric: true
                }
               },
            });
     });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Sparky
  • 98,165
  • 25
  • 199
  • 285
  • This issue is mentioned in the documentation as well as many question posted here. Please use the search function. – Sparky Jan 26 '23 at 18:41
  • Also, using the Code Snippet feature is pointless when you don't include enough code to run anything. – Sparky Jan 27 '23 at 02:27
  • The answer give in the above links not working , As I mentioned that in the input array I used index but still it is not working . – Santosh Chakraborty Jan 28 '23 at 04:33
  • There were four answers linked above and the code works when properly implemented. Read all four, now five. Also, like I said in first comment, you could use the search function as well. 1) You must have a unique `name` attribute on every `text` input and 2) use an index in the array to ensure the name is unique. And this: https://stackoverflow.com/q/26022085/594235 – Sparky Jan 28 '23 at 19:04

0 Answers0