thymeleaf下拉框和多选框的修改是被选中
程序员文章站
2022-05-01 23:15:20
...
<select onchange="getChilds(this.value)" class="form-control select2" id="catId" name="catId">
<option value=""> -- 请选择 -- </option>
<option th:selected="${goods.catId eq c.id}" th:each="c:${categoryList}" th:value="${c.id}" th:text="${c.name}" value="1">蔬菜</option>
</select>
<input id="serveCity1" name="serveCity" value="北京" type="checkbox" th:checked="${#strings.contains(supplierDirectory.serveCity,'北京')}" >北京
<input id="serveCity2" name="serveCity" value="长沙" type="checkbox" th:checked="${#strings.contains(supplierDirectory.serveCity,'长沙')}" >长沙