How does jquery select the option under select based on a value
<script type="text/javascript"> $(document).ready(function(){ var str=""; str = '${conclusionTypeName}'; $("#firstName option").each(function(){ alert($(this).text()); if($(this).text() == str){ $(this).attr("selected",true); } }); }); </script>
Note: The red mark code represents a Chinese string passed from Action to the page (conclusionTypeName must be defined as global Variable, this expression can avoid the problem of Chinese garbled characters, and there is no need to transcode in Action)
<s:select id="firstName" name="id" list="nodeList" listKey="id" listValue="name" onchange="send()" headerKey="0" headerValue="---请选择结论词类型---" /><br/>
The above jquery example code to select the option under select based on a value is shared by the editor I’ve given you all the content, I hope it can give you a reference, and I hope you will support the PHP Chinese website.
For more jquery to select the option instance code under select based on a value, please pay attention to the PHP Chinese website!