How do we validate array of array input boxes using jquery validation plugin?
Below is html code.
<form id="transport-form">
<div class="form-group>
<label> Room1</label>
<input type="text name="child[0]" value="2">
<input type="text" name="age[0][]">
<input type="text" name="age[0][]">
</div>
<div class="form-group>
<label> Room2</label>
<input type="text name="child[1]" value="2">
<input type="text" name="age[1][]">
<input type="text" name="age[1][]">
</div>
<input type="submit value="submit">
</form>
I have no of child input child[*] and accept to each children an age.
If I input 2 children there age need to be filled mandatory.
and jquery code is below
jQuery("#transport-form").validate({
rules: {
'age[*][]': {
required: function(element){
check age is between 1 to 12
}
}
},
});