Disappearance of the form after any alert, prompt or confirm execution😞. Please check the code by clicking the link.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Disappearance of the form after any alert, prompt or confirm execution😞. Please check the code by clicking the link..

Whenever i use alert, prompt or confirm, all the graphics disappear after executing it. I did it so that when the user did not complete the form it will alert the user to complete it but after that everything dissapears.. How will i do it so that it stays and not dissapear? Here is the code👇 https://code.sololearn.com/WqcmIWxw4KO8/?ref=app

9th Aug 2019, 9:23 AM
Joseph Onipede
Joseph Onipede - avatar
2 Answers
+ 4
Ok
9th Aug 2019, 10:37 AM
Joseph Onipede
Joseph Onipede - avatar
+ 1
This has nothing to do with the alerts. You're using the line <a href="www.wap.com" onclick="doc()">Submit</a> to call your js code. Note, that this is a link and you have an href defined. So whenever you click 'Submit' it will first execute your doc() function (where the alerts happen) and after that it will follow the link. Because you didn't specify a protocol (like http) it will search the file on the local folder. In this case sololearns server, which does not exist and therefore giving you an an empty page (or error). If you want to got to the website use href='http://wap.com'. (Although sololearn seems to prevent this, but it works in the real world).
9th Aug 2019, 10:00 AM
Julian Konrath
Julian Konrath - avatar