0

I am using jqueryvalidation library for validation of my forms. It works perfectly other than the input fields that have the following structure:

<input name="my_name[]">    
<input name="my_name[]">
  .
  .
  .
<input name="my_name[]">

The number of these <input> are not known in advance.

Now my question is that how to add rules for these elements, as [] are not valid identifier characters? Does JavaScript has something like PHP escaping mechanism: {'my_name[]'}?

Note: Usage of rules object in jqueryvalidation found here:

$(".selector").validate({
    rules: {
        // simple rule, converted to {required:true}
        name: "required",
        // compound rule
        email: {
            required: true,
            email: true
        }
    }
});
Musa Haidari
  • 2,109
  • 5
  • 30
  • 53

0 Answers0