I have a login page made with HTML and CSS, and I need to prevent the login with JavaScript under certain conditions, but I still have not gotten much time to do this . I'm searching the internet, but I still have not been able to do that. At most I was able to pop-up if the conditions were not met, but I could not prevent login with return false
.
The conditions:
- The password must be longer than 6 characters;
- E-mail field can not be empty;
My HTML:
<html>
<head>
<meta charset="utf-8">
<title>
Login
</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body id="body">
<h1 id="titulo">
Logue-se por favor
</h1>
<form id="login-form">
<input id=email class=displayBlock type="email" placeholder="Email">
<input id="senha" class=displayBlock type="password" placeholder="Senha">
<label class=displayBlock >
<input type="checkbox"> Lembrar-me
</label>
<input id=entrar-btn type="submit" value="Entrar">
</form>
<script src="script.js"></script>
</body>
</html>