Ajax validation with tabular form

I am making a tabular form to insert multiple records from the same view.

My idea is to have a “Add” button to add dynamic fields, I know I could use wbraganca’s DynamicFormWidget but I want to learn how to do it myself to customize the JS operation.

I have problems validating with ajax client side the fields I create dynamically using JS an example of a field I think is:

<div class="form-group field-contratos-0-ctra_nombre required">

<label class="control-label" for="contratos-0-ctra_nombre">Ctra Nombre</label>

<input type="text" id="contratos-0-ctra_nombre" class="form-control" name="Contratos[0][ctra_nombre]" value="1" maxlength="255">

<div class="help-block"></div>

Can you help me please?