Skip to content

Commit

Permalink
- added an event listener for the input icon
Browse files Browse the repository at this point in the history
  • Loading branch information
rezamini committed Nov 29, 2023
1 parent f8843c3 commit ea65f81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const strengthMeter = document.getElementById("strength-meter");
const passwordInput = document.getElementById("password-input");
const reasonsContainer = document.getElementById("reasons");
const passwordIconImg = document.getElementById("toggle-password");

passwordIconImg.addEventListener('click', () => {
const inputAttribute = passwordInput.getAttribute('type') === "text" ? "password" : "text";
passwordInput.setAttribute("type", inputAttribute);
});

passwordInput.addEventListener("input", updateStrengthMeter);
updateStrengthMeter(); //calculate the password strength immediately based on the input current password
Expand Down

0 comments on commit ea65f81

Please sign in to comment.