Firefox忽略选择的选项=“选定” [英] Firefox ignores option selected="selected"
问题描述
如果您更改下拉列表并刷新页面,Firefox似乎忽略了所选属性。
If you change a dropdown and refresh the page, Firefox seems to ignore the selected attribute.
<option selected="selected" value="Test">Test</option>
事实上,它将选择先前选择的选项(刷新之前)。这最终对我来说是一个问题,因为在下拉菜单上触发了一个事件,它改变了其他的事情。有没有办法使firefox停止这种行为(除了在页面加载时触发另一个事件时)?
It will in fact select the option you had previously selected (before the refresh). This ends up being a problem for me since there is an event triggered on the dropdown which changes other things. Is there a way to make firefox stop this behavior (other than firing another event when the page loads)?
推荐答案
AFAIK,this行为被硬编码到Firefox中。
AFAIK, this behaviour is hard-coded into Firefox.
您可以尝试在页面加载时将每个表单元素设置为其 defaultValue
。
You could try setting each form element to its defaultValue
on page load.
这篇关于Firefox忽略选择的选项=“选定”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!