我有一个登录表单,当您将鼠标悬停在链接上时,它将显示自己。基本上,当您悬停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