【发布时间】:2014-07-18 10:16:09
【问题描述】:
我创建了以下下拉框供用户选择特定年份:
<springform:select id="firstYear" path="member.attributes[firstYear].value" value=" " tabindex="3">
<option disabled="disabled" value=" " selected="selected">Select year:</option>
<springform:options id="years" items="${years}"/>
</springform:select>
但是,我想设置这样,如果用户选中特定复选框,则清除此下拉列表并将空白值保存到数据库中。目前它正在保存数组中的第一个值${years},这是不可取的。这是我尝试用来清除它的 javascript:
$("#firstYear option:selected").prop("selected", false);
$("#firstYear").selectedIndex=-1;
我也尝试将firstYear 的值设置为" ",但这也没有用。
任何帮助将不胜感激!
【问题讨论】:
标签: java javascript html spring jsp