+ 1
How to hide a form on submit
Hiding and displaying another div https://code.sololearn.com/WoHys05rAkry/?ref=app
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,
+ 1
You could add a function that sets display to none on button click
+ 1
Lisa already added but not working
+ 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";
}
+ 1
JaScript why didn't it hide on submit initially
+ 1
JaScript
Well I think what soloprog wrote is wrong cos I input it in my code it was filled with error
+ 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";
}
- 1
Kk