如何显示隐藏密码

参考:

HTML5表单中password输入框的文字显示与隐藏实现

密码框的明密文(显示和隐藏) 显示

可以直接拿来用的:

Sample1:

https://nauvalazhar.github.io/my-login/index.html

Sample2:

https://nauvalazhar.github.io/my-login/index.html

Sample2与现有代码集成:

<input type="password" id="inputPassword2" name="password" class="form-control" placeholder="Password" data-toggle="password" required>
<input type="password" id="inputPassword4" name="password" class="form-control" placeholder="Password" data-toggle="password" required>
暂时还有bug,当密码为隐藏状态时,右侧的小眼睛会把比密码框更高,但是密码为显示状态时并不会有这个问题。
显示的显示效果如下:

此登录页面的源码来自以下https://v3.bootcss.com/examples/signin/,我将其放至了Thymeleaf框架中。

原文地址:https://www.cnblogs.com/huanghongbo/p/8927348.html