html select怎么设置默认选中项

admin 阅读:104 2024-03-03

html select通过selected属性设置默认选中项,代码如下:


<select id="user">
    <option value="zhangsan">张三</option>
    <option value="lisi" selected = "selected">李四</option>
    <option value="wangwu">王五</option>
</select>
声明

1、部分文章来源于网络,仅作为参考。
2、如果网站中图片和文字侵犯了您的版权,请联系1943759704@qq.com处理!