兼容所有浏览器, 关闭记住密码的input的自动填充功能

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/deng1456694385/article/details/88647641

当你在登陆页面选择了记住密码,会导致在后面修改密码的输入框中,直接自动填充密码.想要古娜彼自动填充.

方法一:

在表单中创建一个不显示的input且type等于password

<input type="password"  style="position: absolute;z-index: -999">

由于密码直接填充到这个input中所以不会在真正的input上显示

方法二

使用autocomplete="new-password"

<Input type='password'  autocomplete="new-password"/>

这是一个新属性,兼容所有浏览器.

注意:如果用react的jsx时要写autoComplete="new-password",区分属性大小写

猜你喜欢

转载自blog.csdn.net/deng1456694385/article/details/88647641