浏览器缓存选择标记状态并忽略selected =“true” [英] Browser caching select tag state and ignoring selected="true"

查看:98
本文介绍了浏览器缓存选择标记状态并忽略selected =“true”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 selected =true来渲染一个包含当前选定值的下拉框。

I'm rendering a drop down box that contains a currently selected value using selected="true".

<select id="dropDown"> 
    <option selected="true" value="1">value2</option>
    <option value="2">value3</option>
    <option value="3">value4</option>
</select>

最初所选值对应于 selected =true,但是如果我玩弄下拉框然后刷新页面,则忽略 selected =true,并且显示的值是最后一个我选择。我试着用 selected =selected得到相同的结果。
感谢您的帮助。

Initially the selected value corresponds to the selected="true", but if I play around with the drop down box and then refresh the page the selected="true" is ignored and the displayed value is the last one I chose. I tried using selected="selected" with the same results. Thanks for your help.

推荐答案

将您的选择字段更改为< select id = dropDownautocomplete =off>

Change your select field to <select id="dropDown" autocomplete="off">

这篇关于浏览器缓存选择标记状态并忽略selected =“true”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆