我使用
htmx
以及Django表单库。
这是我的模板:
<table>
<tr hx-post="{{ object.get_absolute_url }}" hx-swap="outerHTML"
hx-trigger="changed">
<th>{{ object.leg.start }}</th>
<th>--></th>
<th>{{ object.leg.end }}</th>
<th>{{ object.leg.distance }}m</th>
<th>{{ object.leg.difficulty_verbose }}</th>
<td>{{ form.runner }} {{ form.runner.errors }}</td></tr>
</table>
以下是创建的html:
<table>
<tr hx-post="/leg/155/Talfreunde/ %}" hx-swap="outerHTML" hx-trigger="changed">
<th>Schöneck</th>
<th>--></th>
<th>Mühlleithen</th>
<th>13400m</th>
<th>hard</th>
<td>
<select name="runner" required id="id_runner">
<option value="">---------</option>
...
</select>
</td>
</tr>
</table>
我想要
<tr>
表现得像一种形式。
我试着想办法告诉你
hx-trigger
侦听的更改事件
<select>
。
如何告诉htmx在
select
是否已更改?
背景:这是一个Relayrace,每条腿都是表格中的一行。