Calculate age from datepicker & put result in readonly field?
-
Title says it all. I tried this datepicker age calculator, but it doesn’t work when I plug my elements & variables into it:
jQuery('#dob').datepicker({ maxDate: '+0d', yearRange: '1920:2010', changeMonth: true, changeYear: true, onSelect: function(value, ui) { var today = new Date(), dob = new Date(value), Lage = new Date("2014-04-30"), age = new Date(Lage - dob).getFullYear() - 1970; jQuery('#age').val(age); } });
Also tried a few others I found, but none work.
Any tips on how to accomplish this?
- The topic ‘Calculate age from datepicker & put result in readonly field?’ is closed to new replies.