[英]auto complete attibute not working in HTML
我有帶有電子郵件地址的輸入框。 它不應該是自動完成的,但即使在輸入框中添加了 autocomplete="off" 之后也是如此。 它顯示自動完成值。
它可能在 chrome 中找到...但你可以試試
在表單標簽中添加autocomplete="off" autocomplete="false" autofill="off"
然后在表單打開后添加以下代碼...
<input type="text" name="usernamefake" style="display:none;">
<input type="password" name="fakepassword" style="display:none;">
<!-- from here now your all input fields...below-->
如果使用上述解決方案無法解決您的問題,您可以在實際電子郵件輸入字段上方再添加一個隱藏的假輸入字段,然后嘗試...
更新 :
你可以試試
<input type="text" name="email" readonly onfocus="if (this.hasAttribute('readonly')) {
this.removeAttribute('readonly');
this.blur(); this.focus(); }" />
this.blur(); this.focus();
用於移動屏幕在刪除 readonly 屬性后顯示鍵盤..by js
示例代碼:
div{ padding:10px; margin:20px; } input { padding:5px; margin:5px; }
<div> <form autocomplete="off"> <label for="email">E-Mail</label> <input id="email" readonly type="email" onfocus="if (this.hasAttribute('readonly')) { this.removeAttribute('readonly'); this.blur(); this.focus(); }" /> <br/> <label for="pw">Password</label> <input id="pw" readonly type="password" onfocus="if (this.hasAttribute('readonly')) { this.removeAttribute('readonly'); this.blur(); this.focus(); }" /> <br/> <input type="submit" value="Go!" /> </form> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.