+ 1

How to hide a form on submit

Hiding and displaying another div https://code.sololearn.com/WoHys05rAkry/?ref=app

28th Nov 2021, 6:28 PM
D Doyen
D Doyen - avatar
8 Answers
+ 3
D Doyen , you can hide the form ie in this way (using now password = 1234): https://code.sololearn.com/Wpm9LwQ10GLW/?ref=app,
28th Nov 2021, 8:38 PM
JaScript
JaScript - avatar
+ 1
You could add a function that sets display to none on button click
28th Nov 2021, 6:33 PM
Lisa
Lisa - avatar
+ 1
Lisa already added but not working
28th Nov 2021, 6:39 PM
D Doyen
D Doyen - avatar
+ 1
Your code needs some improvements. Html <input type="submit" value="SUBMIT"> JS let fom = document.getElementById("fom"); window.onload=function(){ fom.style.display="block"; } func = () => { fom.style.display="none"; let btn=document.getElementsByTagName("button"); btn[0].style.display="block"; }
28th Nov 2021, 8:45 PM
SoloProg
SoloProg - avatar
+ 1
JaScript why didn't it hide on submit initially
29th Nov 2021, 6:21 AM
D Doyen
D Doyen - avatar
+ 1
JaScript Well I think what soloprog wrote is wrong cos I input it in my code it was filled with error
29th Nov 2021, 4:30 PM
D Doyen
D Doyen - avatar
+ 1
D Doyen , I noticed mistakes in your code so: in HTML input tag Instead of type = "button" write: type="submit. and in JS remove all the code and replace it with this: let fom = document.getElementById("fom"); window.onload=function(){ fom.style.display="block"; } func = () => { fom.style.display="none"; let btn=document.getElementsByTagName("button"); btn[0].style.display="block"; }
30th Nov 2021, 6:48 PM
SoloProg
SoloProg - avatar
- 1
Kk
29th Nov 2021, 5:07 PM
D Doyen
D Doyen - avatar