【发布时间】:2011-09-04 11:05:45
【问题描述】:
我在 django 模板中有以下代码:
{% for item in items %}
<tr onclick="{% url collection:viewitem item_id=item.id %}">
<td>{{ item.name }}</td>
<td>{{ item.date }}</td>
<td>
<button onclick="{% url collection:edititem item_id=item.id %}" type="button">Edit</button>
<button onclick="{% url collection:removeitem item_id=item.id %}" type="button">Remove</button>
</td>
</tr>
{% endfor %}
但是,按钮 onclick 事件不起作用,因为 tr onclick 似乎覆盖了它。我怎样才能防止这种情况发生?
【问题讨论】:
标签: javascript html django-templates