Show/hide password onClick of button using Javascript only

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

    In your code everytime when you call showHide() function, pwShown variable is set to 0.

    You need to declare pwShown variable as global one.

    var pwShown = 0;
    function showHide()
    {
     ...
    }
    

提交回复
热议问题