下拉框指定赋值,通过循环
(也有其他方法,比如map集合,或者直接取值判定,这只是其中一种)
<select class="enableSelect" id="parentCode" name="parentCode"><option value="">-- 请选择 --option><option th:each="m: ${moduleList}" th:value="${m.code}"th:text="${m.name}"/>select>
var select = document.getElementById('parentCode');for (var i = 0; i < select.options.length; i++) {if (select.options[i].value == pCode) {select.options[i].selected = true;break;}}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
