+ 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

13th Apr 2017, 5:32 PM
Karuma Tendai
Karuma Tendai - avatar
7 Antworten
+ 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
13th Apr 2017, 5:43 PM
Style Jr.
Style Jr. - avatar
+ 8
ow it worked 😂😂😂 thank you guys , I appreciate a lot
13th Apr 2017, 6:48 PM
Karuma Tendai
Karuma Tendai - avatar
+ 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');
13th Apr 2017, 5:46 PM
Ashwani Kumar
Ashwani Kumar - avatar
+ 3
Hey, check my code. There is your problem solved. https://code.sololearn.com/WwmFrrGSX8ez/?ref=app
13th Apr 2017, 6:29 PM
Elvis Briceño
Elvis Briceño - avatar
+ 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.
13th Apr 2017, 5:44 PM
Elvis Briceño
Elvis Briceño - avatar
6th Oct 2020, 2:53 PM
HARDIK JAIN
HARDIK JAIN - avatar
+ 2
https://code.sololearn.com/W0cf1rVw0kZh/?ref=app
6th Oct 2020, 2:54 PM
HARDIK JAIN
HARDIK JAIN - avatar