I am assuming that you have same validation type for each input group, and I am sure that you generate a new name for the new input right?
When you duplicate the input with name="field"
.. make the duplicated name="field-2"
In jQuery use start with selector to validate these fields
$( "input[name^='field']" ) // This will match field and field-2
More Advanced Method:
If you need to access these dynamic fields. You will need to generate your own data-Anything
When you have an input such as
<input type="text" name="field" data-order="0" data-type="mytype" data-duplicated="FALSE">
The duplicated can be like this
<input type="text" name="field2" data-order="1" data-type="mytype" data-duplicated="TRUE">
Then access the second one like this in jQuery
$("input").each(function(index){
if($(this).data("type") == "mytype" && $(this).data("order") == 0){
// validate
}
});
To access all duplicated using order or duplicated field. you can use what you want.
$("input").each(function(index){
if($(this).data("type") == "mytype" && $(this).data("order") > 0){
// validate
}
});
So, basically you can define your data-attributes as the way you want dynamically, and access them by looping through the current inputs in the HTML page. When you find the input apply the validation function immediately.