我尝试了以下方法来关闭浏览器自动完成功能。
1 。添加autocomplete="off",autocomplete="false" and autocomplete="new_password
"形成和输入字段
<form autocomplete="off" name="cardForm" novalidate>
<div class="row form-group">
<label class="col-sm-2 control-label">Security Code</label>
<input type="password" class="form-control" id="securityCode" ng-model="add.ccInfo.Securitycode" name="Security" autocomplete="off">
</div>
2 即可。并尝试在密码字段前添加隐藏的输入字段 像这样
<input type="hidden" name="Security" >
<input type="password" class="form-control" id="securityCode" ng-
model="add.ccInfo.Securitycode" name="Security" autocomplete="off">
3 。还尝试将输入字段的类型从text
更改为password
将焦点放在输入字段
<form autocomplete="off" name="cardForm" novalidate>
<div class="row form-group">
<label class="col-sm-2 control-label">Security Code</label>
<input type="password" class="form-control" id="securityCode" data-ng-focus="add.changeType()" id="securityCode" ng-model="add.ccInfo.Securitycode" name="Security" autocomplete="false">
</div>
和js part
add.changeType = function () {
var el = angular.element(document.querySelector('#securityCode'));
el.attr("type", "password")
}