<script type="text/javascript">
$(document).ready(function(){
var qx_value = $('#qx_select_value').val();
$("#qx_select option[value='"+qx_value+"']").attr("selected", "selected");
})
</script>
$("#qx_select option[value='"+默认显示的option的值+"']").attr("selected","selected");
postUpdate.jsp中HTML中body的代码:
<input type="hidden" id="qx_select_value" value="${jd.qxid }"/> /*通过hidden把上个action中的select需要选中的value存储起来,以便于jquery调用。*/
<select id="qx_select" name="qxid" onChange="selectjd()">
<c:forEach items="${qxlist }" var="qx">
<option value='${qx.qxid }'>${qx.qx }</option>
</c:forEach>
</select>
var qx_select_value = $("#qx_select").val();
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有