Input form validation JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Input form validation JS

Hi, everyone! I need your help please! Something wrong with my code of validation form js. The first input email is almost working except the second error message (email invalid). The problem is when I test password input, doesn't work anything including email input. And how to check checkbox input? Is (checkboxValue === false) right ? https://code.sololearn.com/W62xfOugew4j/?ref=app

29th Nov 2021, 4:59 AM
Elena
Elena - avatar
2 Answers
+ 3
Elena , first use window.onload in JS to load the whole html. To check if the checkbox is checked, use "checked" property which is a boolean.
29th Nov 2021, 7:27 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
The problem is at line 49 50 With querySelector you are always getting the first match. You should use the first argument to find the right target to style/display. https://code.sololearn.com/W55e103mw93L/?ref=app
29th Nov 2021, 7:28 AM
Gordon
Gordon - avatar