thymeleaf(th:each th:selected) 从后台动态获取下拉框数据回显及选中

<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>

说明1:红色代码部分为下拉框数据回显。

说明2:黄色代码部门为下拉框选中

猜你喜欢

转载自blog.csdn.net/lei_da_gou/article/details/80741573
th