Show/hide password onClick of button using Javascript only

后端 未结 13 957
孤城傲影
孤城傲影 2020-12-08 22:47

I want to create password toggle function when clicked on the eye icon using Javascript only. I have written code for it but it works only to show the password text and not

13条回答
  •  难免孤独
    2020-12-08 22:53

    We can get by using onclick event, let's see example.It is very easy

    HTML

    
          eye
    
    

    Javascript

    function showHide() {
                    if (pwd.type == 'text') {
                        pwd.type = 'password';
                    }
                    else {
                        pwd.type = 'text';
                    }
                }
    

提交回复
热议问题