<select>
<option th:each="city:${cities}"
th:value="${city.value}"
th:utext="${city.name}"/>
</select>
<div th:text="here"></div>
如何从文本中获取选定的值?
答案 0 :(得分:0)
您必须使用jQuery或javascript来获取并设置选定的值,例如波纹管
var city=$('#city :selected').text();
$('#city_selected').val(city)
<select id="city">
<option th:each="city:${cities}"
th:value="${city.value}"
th:utext="${city.name}"/>
</select>
<div >
<input id="city_selected"/>
</div>