+ 1
Form validation question
So I just want to be clear here, so it's not possible to write multiple "if" statements like in this code, or is there a way to manipulate it? https://code.sololearn.com/WJGjUpqbUCuX/?ref=app
3 Antworten
+ 4
my approach to this will be first put required attribute to field that should not be blank.
by doing so you dont need to check if they are empty
https://code.sololearn.com/WieiQzw3D5Y4/?ref=app
+ 1
I have tried it as this.
https://code.sololearn.com/W5kz3Ly4F6p7/?ref=app
+ 1
You can do this btw
if (n1.value != '' && n2.value != '' && n1.value == n2.value)
But it's better to follow Tastes approach