根据数据库信息设置默认颜色 ,${bean.color}是后台传过来的value值;color对应的是select的id
jquery代码如下:
$("#color option[value=${bean.color}]").attr("selected", "selected");
select代码:
<select name="color" id="color" > <option value="Black" >黑色</option> <option value="Gray" >灰色</option> <option value="Blue" >蓝色</option> <option value="DeepSkyBlue" >天蓝色</option> <option value="Purple" >紫色</option> <option value="DeepPink" >深粉色</option> <option value="Violet" >紫罗兰色</option> <option value="Pink" >粉红色</option> <option value="LimeGreen" >酸橙绿</option> <option value="Green" >绿色</option> <option value="YellowGreen" >黄绿色</option> <option value="Orange" >桔×××</option> <option value="Red" >红色</option> <option value="Brown" >褐色</option> <option value="BurlyWood" >木色</option></select>