I am using jquery validator plugin to validate inputs
liberary url : https://jqueryvalidation.org/
i have al form where input fieds are dynamically generated and each row input names are same
<tr> <td><input type="text" class="form-control username" name="username"/></td> </tr>
when user click on add button then one more row will add
<tr>
<td><input type="text" class="form-control username" name="username"/></td>
</tr>
i have following validation
$validator = $("#myform").validate(
{
rules: {
username: {
required: true,
}
}
}
);
my problem is this code will validate only first row username not dynamically generated field name
before asking question i have researched lots of thread no use.
i ref many links but not helped me much
jQuery Validate multiple fields with the same name
jquery get all input from specific form
jquery validate plugin on dynamic form inputs not working
jQuery Validation plugin doesn't validate dynamically created form elements