+ 9
How to add a show password checkbox
I'm creating a login form in html so i want to add a checkbox which then makes the password clear and the user can see it . How can i achive that
7 Answers
+ 9
Using JavaScript you can make that
<input type="password" id="password">
<input type="checkbox" onchange="document.getElementById('password').type = this.checked ? 'text' : 'password'"> Show password
+ 8
ow it worked đđđ thank you guys , I appreciate a lot
+ 4
Flip the type of input field on check/uncheck of checkbox.
Like on checked - document.getElementById('input').setAttribute('type', 'text');
And on unchecked - document.getElementById('input').setAttribute('type', 'password');
+ 3
Hey, check my code. There is your problem solved.
https://code.sololearn.com/WwmFrrGSX8ez/?ref=app
+ 2
Hello, first of all, I am sorry for my English xD
Ok, you can set a button and with an onclick event, use Javascript to change the Input type. So it changes from password to text.
+ 2
https://code.sololearn.com/W0cf1rVw0kZh/?ref=app