I have a problem here with this modal form. JS works fine, but the modal window pops up and disappears quickly. How to solve?
<a href="" id="signin"><li>Entrar</li></a></a>
</ul>
</div>
</nav>
</div>
</header>
<!--modal-->
<div class="modal">
<form class="modal-content animate">
<div class="imgcontainer">
<span class="close" title="sair">×</span>
<img src="img/users.png" alt="users" class="avatar">
</div>
<div class="container">
<label for="uname"><b>E-mail</b></label>
<input type="text" name="uname" placeholder="Entre com o seu e-mail" required>
<label for="psw"><b>Senha</b></label>
<input type="password" name="psw" placeholder="insira sua senha">
<button type="submit">Entrar</button>
<label>
<input type="checkbox" name="lembrar" checked="checked">Lembre-ne
</label>
</div>
<div class="container"style="background-color: #f1f1f1">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancelar</button>
<span class="psw">Esqueceu a <a href="">senha?</a></span>
</div>
</form>
<script>
document.getElementById("signin").addEventListener("click", function(){
document.querySelector('.modal').style.display = "block";
});
document.querySelector(".close").addEventListener("click", function(){
document.querySelector('.modal').style.display = "none";
});
</script>