I have a site that is covered by a div. I want to make the div disappear when someone enters the correct password. I validate the form with Javascript and successfully change the CSS of that div from display:block to display:none, but immediately after the display property has been changed it changes back to default again. I want to have it so the display of #overlay is forever set to none if the password is correct.
The form.
<form id="overlay-form" name="overlay-form" method="post" onsubmit="validateForm();">
<input id="overlay-password" name="overlay-password" type="password">
<input type="submit" id="overlay-submit" value="Submit">
</form>
Javascript.
<script>
function validateForm() {
var x = document.forms["overlay-form"]["overlay-password"].value;
if (x == "password") {
document.getElementById('overlay').style.display = "none";
}
}
</script>