ok
Direktori : /home2/selectio/public_html/wedding-info/new/ |
Current File : /home2/selectio/public_html/wedding-info/new/eye.php |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Toggle Password Visibility</title> </head> <body> <div class="container"> <h1>Sign In</h1> <form method="post"> <p> <label for="username">Username:</label> <input type="text" name="username" id="username"> </p> <p> <label for="password">Password:</label> <input type="password" name="password" id="password" /> <i class="bi bi-eye-slash" id="togglePassword"></i> </p> <button type="submit" id="submit" class="submit">Log In</button> </form> </div> <script> const togglePassword = document.querySelector("#togglePassword"); const password = document.querySelector("#password"); togglePassword.addEventListener("click", function () { // toggle the type attribute const type = password.getAttribute("type") === "password" ? "text" : "password"; password.setAttribute("type", type); // toggle the icon this.classList.toggle("bi-eye"); }); // prevent form submit const form = document.querySelector("form"); form.addEventListener('submit', function (e) { e.preventDefault(); }); </script> </body> </html>