我有一個登錄表單,當您將鼠標懸停在鏈接上時,它將顯示自己。基本上,當您懸停a
時,表單將其規則更新爲display: none
至display: block
懸停自動填充建議會使元素消失
當我開始填寫字段時,瀏覽器根據先前的輸入顯示建議。但是當我想要選擇建議時,element
將自己重新設置爲display: none
。我不想設置autocomplete="off"
。
示範
* {
box-sizing: border-box;
}
form {
display: none;
}
div:hover form {
background-color: #f1f1f1;
display: block;
padding: 15px;
}
<p>Fill in a sample username and password, after that you get an fiddle error. Just reload the fiddle and then the autocomplete shows you suggestions</p>
<div class="hover">
<span>HOVER TO SHOW LOGIN FORM</span>
<form method="post">
<input type="text" id="username" name="username" placeholder="username" />
<input type="password" id="password" name="password" placeholder="password" />
<input type="submit" name="login" value="login" />
</form>
</div>
如何防止這種行爲?
類將被添加你使用哪種瀏覽器? –
你可以添加自動完成=「關閉」屬性 –
所有瀏覽器同樣的問題。 IE,FF和Chrome。我不想設置自動完成=「關閉」 – Red