After following a tutorial on building a basic login form, I decided to enhance it by incorporating a show/hide password feature using JavaScript. Unfortunately, despite the tutorial working flawlessly, I encountered issues when implementing it myself. I attempted solutions from a related article here but none seemed to solve the problem.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTG-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website Login & Registration | Nick</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https:stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://kit.fontawesome.com/0938e96d29.js" crossorigin="anonymous"></script>
<div class="form-box login">
<h2>Login</h2>
<!--Allows the use of a form box-->
<form action="#">
<div class="input-box">
<i class="fa-regular fa-envelope"></i>
<input type="email" required>
<label>Email</label>
</div>
<div class="input-box">
<span class="icon-eye-outline" id="icon-eye-outline"><ion-icon name="eye-outline"></ion-icon></span>
<input type="password" required id="password">
<label>Password</label>
<i class="fa fa-eye" id="show-password"></i>
</div>>
<div class="remember-forgot">
<label><input type="checkbox"> Remember me</label>
<a href="#">Forgot Password?</a>
</div>>
<button type="submit" class="btn">Login</button>
<div class="login-register">
<p>Don't have an account?
<a href="#" class="register-link">Register</a>
</p>
</div>
</form>
</div>