Salve, vorrei creare un controllo in Js per i tre input che l'utente inserisce, solo che è come se il codice js non ci fosse proprio quando testo. Dove sbaglio? I controlli non vengono proprio fatti
<!DOCTYPE html>
<html>
<head>
<title>Registrazione</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap">
<link rel="stylesheet" href="style2.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script type="text/javascript">
function validation(){
var user = document.getElementById('Username').value;
var pass = document.getElementById('Pass').value;
var codice = document.getElementById('Codice').value;
if(user == ""){
document.getElementById('Username').innerHTML =" ** Please fill the username field";
return false;
}
if((user.length <= 2) || (user.length > 20)) {
document.getElementById('Username').innerHTML =" ** Username lenght must be between 2 and 20";
return false;
}
if(pass == ""){
document.getElementById('Pass').innerHTML =" ** Please fill the password field";
return false;
}
if((pass.length <= 5) || (pass.length > 20)) {
document.getElementById('Pass').innerHTML =" ** Passwords lenght must be between 5 and 20";
return false;
}
if(codice == ""){
document.getElementById('Codice').innerHTML =" ** Please fill the codice field";
return false;
}
if(codice!="777") {
document.getElementById('Codice').innerHTML =" codice doesn't match";
return false;
}
}
</script>
</head>
<body>
<form method="post" action="registrazione.php" name="registrazione" onsubmit="return validation()">
<h1>Registrazione</h1>
<input type="text" id="Username" placeholder="Username" name="Username" maxlength="50" required>
<input type="password" id="Pass" placeholder="Password" name="Pass" required>
<input type="password" id="Codice" placeholder="codice" name="Codice" required>
<button type="sumbit" name="Registra" >Registrati</button>
<br>
<a href="login.php">
Login Segretario
</a>
<br>
<a href="loginStud.php">
Login Studente
</a>
</form>
</body>
</html>