$(document).ready(function () {
  const togglePassword = document.querySelector("#togglePassword");
  const password = document.querySelector("#password");

  let pass = togglePassword;

  if (pass) {
  togglePassword.addEventListener("click", function () {
    // toggle the type attribute
    const type = password.getAttribute("type") === "password" ? "text" : "password";
    password.setAttribute("type", type);
    // toggle the eye icon
    if (type === "text") {
      $(this).removeClass("bi-eye");
      $(this).addClass("bi-eye-slash");
    } else {
      $(this).removeClass("bi-eye-slash");
      $(this).addClass("bi-eye");
    }
  });
}
});
