如何控制在控件中选择哪个选项?

时间:2021-10-25 15:05:37

What I tried is by adding selected, but this is not working:

我尝试的是添加选中,但这不起作用:

<select>
 <option value="-1" selected>--</option>
 <option value="0">femail</option>
 <option value="1">male</option>
</select>

2 个解决方案

#1


Several browsers will save your current selection when you reload the page. Try clearing your browsers cache and reloading the page (shift + f5). What you have above should be correct.

重新加载页面时,多个浏览器将保存您当前的选择。尝试清除浏览器缓存并重新加载页面(shift + f5)。你上面的内容应该是正确的。

#2


Try selected="selected"

#1


Several browsers will save your current selection when you reload the page. Try clearing your browsers cache and reloading the page (shift + f5). What you have above should be correct.

重新加载页面时,多个浏览器将保存您当前的选择。尝试清除浏览器缓存并重新加载页面(shift + f5)。你上面的内容应该是正确的。

#2


Try selected="selected"