我想从出生之日起就知道一个人的年龄.我有一个HTML代码,我正在使用dob的datepicker,当我给出生日期时,它显示自动显示年龄而不提交.请帮我找到解决方案.
DOB calculations
$(function() {
$('#datepicker').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'mm/dd/yy',
//firstDay: 1,
onSelect: function(dateText, inst) {
dateText.split('/');
Bdate = new Date(dateText[2], dateText[0] - 1, dateText[1]);
BDateArr = ('' + Bdate).split(' ');
//document.getElementById('DOW').value = BDateArr[0];
Cdate = new Date;
CDateArr = ('' + Cdate).split(" ");
Age = CDateArr[3] - BDateArr[3];
document.getElementById('AGE').value = Age;
// DOBcalc(dateText);
//DOBcalc();
}
})
});
DOB (mm/dd/yyyy):
Age: