问题描述
我正在构建Bootstrap表单,并且电子邮件和密码表单元素会使用来自某个其他网站或某个其他网站上早期表单登录的预填充数据显示。 Chrome浏览器会自动填充表单元素。
Bootstrap中是否有方法的HTML属性强制这些表单元素在页面加载时为null或为空? p>
2015-10-29 - 这是标记:
< form autocomplete =offmethod =postrole =form>
< div class =form-group>
< input name =formSubmittedtype =hiddenvalue =1>
< / div>
< div class =form-group>
< label for =用户名>用户名< / label>
< input autocomplete =offautofocus =autofocusclass =form-controlid =usernamename =usernamerequired type =text>
< / div>
< div class =form-group>
< label for =password>密码< / label>
< input autocomplete =offclass =form-controlid =passwordname =passwordrequired type =password>
< / div>
< button class =btn btn-defaulttype =submit>登入< / button>
< / form>
使用属性。来自
另见:
I am building a Bootstrap form and the email and password form elements show with pre-populated data from some other or some earlier form login on a different site. The Chrome browser is auto-populating the form elements.
Is there an HTML attribute of method in Bootstrap to force these form elements to null or empty on page load?
2015-10-29 -- here's the markup:
<form autocomplete="off" method="post" role="form">
<div class="form-group">
<input name="formSubmitted" type="hidden" value="1">
</div>
<div class="form-group">
<label for="username">Username</label>
<input autocomplete="off" autofocus="autofocus" class="form-control" id="username" name="username" required type="text">
</div>
<div class="form-group">
<label for="password">Password</label>
<input autocomplete="off" class="form-control" id="password" name="password" required type="password">
</div>
<button class="btn btn-default" type="submit">Login</button>
</form>
Use the autocomplete="off"
attribute on the <form>
or <input>
.
from MDN:
Also from MDN, see: How to Turn Off Form Autocompletion
Also see:
- Chrome Browser Ignoring AutoComplete=Off
- "AutoComplete=Off" not working on Google Chrome Browser
- autocomplete ='off' is not working when the input type is password and make the input field above it to enable autocomplete
这篇关于如何防止在Chrome中预填表单元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!