Goal
Write a script that lets users toggle the visibility of a password field.
Project
View Source
(function() {
let elPassword = document.querySelector( "#password" );
let elShowPassword = document.querySelector( "#show-password" );
elShowPassword.addEventListener( "input", e =>
{
let inputType = e.target.checked ? "text" : "password";
elPassword.setAttribute( "type", inputType );
});
})();
Projects
- Toggle Password Visibility
- Toggle Multiple Password Fields
- Toggle Passwords in Multiple Forms
- Character Count
- Character and Word Count
- Announcing the Count
- Random Ron
- Random Ron Without Duplicates
- New York Times Top Stories
- New York Times Multiple Categories
- Sanitizing the NYT API Data
- Monster Shuffle