[英]How to read text file from server and display only e.g. 100 last lines of it in textview
[英]How select a value from options list and display its fields in other place (e.g. in <input>)
我想從選擇選項中選擇一個對象,並在某些輸入中顯示其字段。
例如,我從列表中選擇一個銀行帳戶
<tr>
<td>From account*</td>
<td style="padding-right: 55px; width: 70%;">
<select th:field="${transaction.accountNumberFrom}" required style="height: 30px;">
<option th:each="account : ${accounts}" th:text="${account.accountNumber} + ' (' + ${account.accountName} + ' : ' + ${account.bank} + ')'" th:value="${account.accountNumber}" />
</select>
</td>
</tr>
然后想在輸入字段中自動顯示它的字段(例如$ {account.currency})或者......
有什么建議么?
由於您的問題沒有提供回答所需的詳細信息,因此我假設很少並嘗試回答。
您可以使用純javascript
或jquery
來實現此目的。 這是使用jquery
一個例子
我假設你的輸入字段是這樣的
<input type="text" name="myinput" id="myinput">
現在你使用jquery on
如下所示
$('select').on('change', function() {
$('#myinput').val(this.value);
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.