鍍金池/ 問答/HTML5  HTML/ 如何取消 input 表單的默認(rèn)行為??

如何取消 input 表單的默認(rèn)行為??

一個用戶登錄的表單:

clipboard.png
clipboard.png
clipboard.png

  1. 刷新頁面的時候如何禁止他自動填充表單導(dǎo)致 input 背景顏色也變黃色??
  2. 表單獲取焦點的時候,如何禁止他產(chǎn)生下拉菜單??
回答
編輯回答
尛憇藌

autocomplete="off"

2018年7月8日 01:08
編輯回答
萌二代

以前記錄到的也許就是樓上說的知乎貼上看到的吧

<input type="password" autocomplete="new-password" />
2018年8月30日 03:14
編輯回答
莫小染

去掉背景的黃色

input:-webkit-autofill {
    -webkit-box-shadow: inset 0 0 0px 9999px white;
}

禁止自動填充

<input type="password" autocomplete="new-password" />
2017年9月19日 08:20
編輯回答
陌顏

來個簡單粗暴的,加上autocomplete="off"。
<input type="text" autocomplete="off" />
還有很多別的辦法,改變input:-webkit-autofill,利用陰影強制去除等等。

2018年8月6日 07:26
編輯回答
尐潴豬

這個是瀏覽器的自動填充,看下這個知乎

2017年5月2日 05:35
編輯回答
純妹
<input type="text" value="" autocomplete="off"  />
<style>
input:focus{
  outline:none;
}
</style>
2017年2月26日 20:29