Can someone please help me with this? function remove() is supposed to move the div away, when the form is submitted. However, this does not happen. What is wrong in the code?
The Gist of the code is here.
snippets:
function remove() {
document.querySelector('.nickname').style.animationPlayState = 'running';
alert('The Form was submitted');
};
@keyframes up {
from {
opacity: 1;
top: 0;
height: 100%;
line-height: 100%;
}
to {
opacity: 0;
top: -110vh;
hight: 0;
line-height: 0;
}
}
.nickname {
display: flex;
flex-direction: row;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
align-items: center;
justify-content: center;
opacity: 1;
animation-name: up;
animation-duration: 1s;
animation-fill-mode: forwards;
animation-play-state: paused;
}
<div class="nickname">
<form onsubmit="remove()" method="POST">
<fieldset>
<legend><h3>Hi there! Choose your nickname:</h3></legend>
<input type="text" name="username" placeholder="Nickname" size="60" autocomlete="off">
<input type="text" name="useremail" placeholder="Email" size="60" autocomlete="off">
<input type="submit" value="Save">
</fieldset>
</form>
</div>