I tried some solution to fix this error like put <script> below </body>
but it didn't work. So how can i fix this. Here is my code. I want to know what is my fault so i can fix this when i met this error again. Thanks first
<body>
<div id="main">
<div id="login">
<h2><strong>Login</strong></h2>
<br>
<form id="info" ac>
<label>Username:</label>
<input type="text" placeholder="Input username" name="username" id="first">
<label>Password:</label>
<input type="password" placeholder="Input password" name="password" id="seconde">
<div>
<button id="bt">Login</button>
</div>
</form>
</div>
</div>
<script>
document.querySelector("bt").addEventListener("click",function(check){
var a = document.querySelector("#first").value;
var b = document.querySelector("#second").value;
if(a=="admin" && b=="123456"){
alert('Login Success!\nRedirecting to next page');
document.querySelector("#info").action="nextpage1.html"
}else{
alert('Login failed!\nIncorrect username or password');
}
})
</script>
</body>