HELP: I used JavaScript to autogenerate age from date of birth in a html form | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

HELP: I used JavaScript to autogenerate age from date of birth in a html form

now i want to check if the age is over a certain number in order to move from the form page to another page. any ideas?

20th Oct 2018, 4:10 AM
mya
mya - avatar
6 Answers
0
like this ? i dont quite understand what you mean if(age>limit){ //movesomewhere }
20th Oct 2018, 4:24 AM
Taste
Taste - avatar
0
Taste this is the code. I want to enable submit button only if age is greater 18 and less than 101. https://code.sololearn.com/W84JjkrYU52d/?ref=app
20th Oct 2018, 4:33 AM
mya
mya - avatar
0
yours are fine, jut change the age limit from 9 to 18 and 12 to 101 the only error are location.href should be window.location.href and why did you need a submit button if the page is redirect automaticly ?
20th Oct 2018, 4:47 AM
Taste
Taste - avatar
0
Taste I just had it because the JavaScript wasn't redirecting.
20th Oct 2018, 4:55 AM
mya
mya - avatar
0
yep, use window.location.href not location.href
20th Oct 2018, 4:56 AM
Taste
Taste - avatar
0
Taste thank you!
20th Oct 2018, 6:56 AM
mya
mya - avatar