
Please help with this custom HTML as I have to display the addition of this duration of experience and validator whether it is more than or equal to 5 years.
CODE:
<script language="JavaScript" type="text/javascript">
for (int i = 0; i < rowLength; i++){
$('input[name="exp"]').change( function(){
d1 = $('input[name="exp"]');
var ex =0;
ex = ex + d1;
function calcDate(ex,d1) {
var diff = Math.floor(ex.getTime() + d1.getTime());
var years = Math.floor(diff/31536000000);
var months= Math.floor((diff%31536000000)/2628000000);
var days = Math.floor(((diff%31536000000)%2628000000)/86400000);
var msg = years + " years ";
msg += months + " months ";
msg += days + " days " ;
return msg
}
}
a = calcDate(ex,d1)
$('input[name=field8]').val(a);
});
</script>