Skip to content

Commit

Permalink
- toggled input image icon
Browse files Browse the repository at this point in the history
  • Loading branch information
rezamini committed Nov 29, 2023
1 parent ea65f81 commit 7fa3df8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ const passwordIconImg = document.getElementById("toggle-password");
passwordIconImg.addEventListener('click', () => {
const inputAttribute = passwordInput.getAttribute('type') === "text" ? "password" : "text";
passwordInput.setAttribute("type", inputAttribute);

//update the icon
if(inputAttribute == "text"){
passwordIconImg.setAttribute("src" , "./icons/show.png");
}else{
passwordIconImg.setAttribute("src" , "./icons/hide.png");
}

});

passwordInput.addEventListener("input", updateStrengthMeter);
Expand Down

0 comments on commit 7fa3df8

Please sign in to comment.