Javascript Magic 4 - Password Visibility Toggle with JavaScript

Publicado em: 09 Agosto 2023
no canal de: The Codebrow
61
1

There's an HTML body tag containing a div element.
Inside the div, there are two input elements:
One is of type "password" with the id "pwd". This is where the user can enter their password.
The other is of type "checkbox" with the id "chk". This checkbox allows the user to toggle the visibility of the password.

The JavaScript code is placed inside a script tag.
It starts by getting references to the password input element and the checkbox input element using document.getElementById().
An event handler is attached to the checkbox's onchange event. This means that when the user interacts with the checkbox (checks or unchecks it), the code inside the event handler will run.

Inside the event handler function, it checks the checked property of the checkbox input element. If the checkbox is checked (check.checked is true), it sets the type attribute of the password input element to "text", making the password characters visible. If the checkbox is unchecked (check.checked is false), it sets the type attribute back to "password", hiding the password characters.


Nesta página do site você pode assistir ao vídeo on-line Javascript Magic 4 - Password Visibility Toggle with JavaScript duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário The Codebrow 09 Agosto 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 61 vezes e gostou 1 espectadores. Boa visualização!