date of birth validation if user is above 16

Your getAge function returns 16 as per your ’10/22/2001′ example.

But your if statement is strange. You don’t need to find out someones birthdate if they were born today.

You can use:

if (getAge($("#year").val()) < 16) {
    // the person is 15 or under
}
else {
    // the person is 16 or over.
}

Leave a Comment