Hi Tran,
I just found the same question asked before 1 year in general section but that seems closed thats why I am asking the same question again because my requirement is same now & validation for cloned field need to work.My problem is little different than previous discussion, there you said it breaks because of changing ID's so I have built my validation on the name attribute but in vain can you please help me?
The following function only works on first row but fails/no action on cloned rows
$("input[name$='fill-time\]'], input[name$='peak-pressure\]']" ).on("focusout", function (){
viscosity = 0.0;
shear_rate = 0.0;
ins_ratio = $("#fm-intensification-ratio").val();
fill_time = $(this).closest(".rwmb-row").find("input[name$='fill-time]']").val();
pk_inj_press = $(this).closest(".rwmb-row").find("input[name$='peak-pressure]']").val();
viscosity = parseFloat(ins_ratio) * parseFloat(fill_time) * parseFloat(pk_inj_press);
viscosity = parseInt(viscosity,10);
shear_rate = parseFloat(1 / parseFloat(fill_time)).toFixed(4);
$(this).closest(".rwmb-row").find("input[name$='viscosity]']").val(viscosity);
$(this).closest(".rwmb-row").find("input[name$='shear-rate]']").val(shear_rate);
} );
Thanks & Regards,
Calpaq