I have a problem similar to this: Using MVC and JQuery to dynamically & consistently add values to a table , but the difference is:
I have table and I'm cloning the last row (to keep the same format) with:
var $tableBody = $('#record').find("tbody");
$trLast = $tableBody.find("tr:last");
$trNew = $trLast.clone();
$trLast.after($trNew);
`
The rows are created succesfully, but the validations are binded to the first row (inputs
, selects
and textarea
)
Inspecting the elment, are displayed:
<td>
// Code generated with the jquery .clone()
<input data-val="true" data-val-required="Es necesario agregar una fecha." id="Salidas_0__Fecha" name="Salidas[1].Fecha" type="datetime" value="" autocomplete="off" class="hasDatepicker input-validation-error">
<span class="field-validation-valid" data-valmsg-for="Salidas[1].Fecha" data-valmsg-replace="true"></span>
</td>
But the field-validation-valid
is not binded to the input
.
Exist a way to do that?