I have a section of form that dynamically generates and increments it's ids. Something like:
<input type='text' name='fname1' id='fname1'/>
<input type='text' name='lname1' id='lname1'/>
I'm trying to go through and validate the form for the first time (I've never used the jQuery validation plugin before) and I began it with the form id "confirm"
$('#confirm').validate({
rules:{
oneoftheinputnameshere:{
required: true
}
}
});
The above is fine while I validate the input fields that don't change, but how would I go about selecting something to validate when I don't know how many times it'll be generated? I looked at some other questions about this and adding a class to every input field that is required, but I'm not sure if that's right or how to go about implenting it.
Any help would be great
EDIT: the ids would increment by one so 'fname2', 'fname3', etc