[英]deselect struts2 select from javascript
how can I deselect struts2 select list from javascripts? 如何从JavaScript中取消选择struts2选择列表?
eg. 例如。
<s:select name="bookIds" list="bookList" listKey="key"
listValue="value" multiple="true" theme="simple"
onchange="getVal(this.options[this.selectedIndex].value,'myvalue');"/>
I want to deselect all the list after onchange event. 我想在onchange事件之后取消选择所有列表。
Declare headerKey
and headerValue
声明
headerKey
和headerValue
<s:select id="book_select" name="bookIds" list="bookList" listKey="key"
headerKey="-1" headerValue="Select Book"
listValue="value" multiple="true" theme="simple"
onchange="getVal(this.options[this.selectedIndex].value,'myvalue');"/>
Javascript Java脚本
function getVal(myvalue){
//do your stuff
document.getElementById("book_select").value="-1";
}
I also suggest that instead of storing the selected values in a hidden field you must show them in some div, otherwise users may get confuse and keep on selecting the same values again and again. 我还建议不要将选定的值存储在隐藏字段中,而必须在某个div中显示它们,否则用户可能会感到困惑,并继续一次又一次地选择相同的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.