Html 如何为th:text使用所选变量
如何从到:text获取所选值?您必须使用jQuery或javascript获取并设置所选值,如下所示Html 如何为th:text使用所选变量,html,thymeleaf,Html,Thymeleaf,如何从到:text获取所选值?您必须使用jQuery或javascript获取并设置所选值,如下所示 var city=$('#city:selected').text(); $(“#选定城市”).val(城市) 您必须使用jQuery或javascript获取并设置所选值,如下面所示 var city=$('#city:selected').text(); $(“#选定城市”).val(城市) <select> <option th:each=
var city=$('#city:selected').text();
$(“#选定城市”).val(城市)
您必须使用jQuery或javascript获取并设置所选值,如下面所示
var city=$('#city:selected').text();
$(“#选定城市”).val(城市)
<select>
<option th:each="city:${cities}"
th:value="${city.value}"
th:utext="${city.name}"/>
</select>
<div th:text="here"></div>