Show/hide password onClick of button using Javascript only

后端 未结 13 892
孤城傲影
孤城傲影 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:47

    This is an improvement upon Tunaki's answer. We don't even care to check which state the form field is in already, because this will be entirely determined by the state of the mouse. This allows the password to be only momentarily viewed (only as long as the mouse button is held down over the button.)

    
    
        Visible Password Test
    
    
    
    Password : 
    
    
    
    
    
    

提交回复
热议问题