Вот мой HTML-код для страницы регистрации, но я не могу проверить поле пароля. что происходит здесь, всякий раз, когда я ввожу пароль и нажимаю на кнопку «Подтвердить пароль», отображается сообщение об ошибке, даже не позволяя мне снова вводить пароль. Пожалуйста, помогите мне исправить это! спасибо!
<!DOCTYPE html>
<html>
<head>
<title>Sign up form</title>
<link rel="stylesheet" type="text/css" href="signup.css">
</head>
<body>
<div class="signup">
<form action="insert.php" method="POST" onclick="return validation();">
<div id="eresult" style="color: red;"></div>
<p>Username</p>
<input type="text" name="username" placeholder="Enter New Username" required id="name">
<p>Email</p>
<input type="Email" name="email" placeholder="Enter Email" required id="email">
<p>Password</p>
<input type="password" name="pass" placeholder="Enter Password" required id="pass">
<p>Confirm Password</p>
<input type="password" name="confpass" placeholder="Confirm Password" required id="confpass">
<input type="submit" name="" value="Submit">
</form>
</div>
<script type="text/javascript">
function validation(){
var name = document.getElementById('name').value;
var email= document.getElementById('email').value;
var password = document.getElementById('pass').value;
var confpassword = document.getElementById('confpass').value;
if(password == confpassword){
return true;
}
else{
alert("Password does not match!!");
return false;
}
}
</script>
</body>
</html>