how to make password textbox value visible when hover an icon

前端 未结 11 1209
误落风尘
误落风尘 2021-01-31 03:01

Good day all,

I have a form that has a password field:


Naturally, the i

11条回答
  •  轮回少年
    2021-01-31 03:52

    You will need to get the textbox via javascript when moving the mouse over it and change its type to text. And when moving it out, you will want to change it back to password. No chance of doing this in pure CSS.

    HTML:

    
    
    

    JS:

    function mouseoverPass(obj) {
      var obj = document.getElementById('myPassword');
      obj.type = "text";
    }
    function mouseoutPass(obj) {
      var obj = document.getElementById('myPassword');
      obj.type = "password";
    }
    

提交回复
热议问题