Why is the page blank after you clicked the button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
4th Jan 2018, 8:09 PM
Luca
3 Answers
+ 17
Buttons in forms cause the form to redirect/submit to its action attribute url... Switch <form> to <div> perhaps?
4th Jan 2018, 9:09 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 7
I prefer @ValentinHacker's answer because I don't think you need a form, but you can also cancel the submit by returning false (this tells Javascript the form failed the 'validator function') 20: return false; // 'validator' says stop
4th Jan 2018, 9:29 PM
Kirk Schafer
Kirk Schafer - avatar
0
oh yes thank you
4th Jan 2018, 10:00 PM
Luca