我正在使用一个插件,它允许我利用表格的扩展部分,点击时会显示更多内容。jQuery可扩展表格行
虽然插件正在工作,但我试图调整一段代码,但无法完全正确。
整行上有一个点击事件,如果我的行包含一个链接,它的导航到链接以及扩大行是不希望的行为。我想让点击事件只发生在点击展开箭头时。
$('.table-expandable').each(function() {
var table = $(this);
table.children('thead').children('tr').append('<th></th>');
table.children('tbody').children('tr').filter(':odd').hide();
// This is the event that is linked to the whole table row
table.children('tbody').children('tr').filter(':even').click(function() {
var element = $(this);
element.next('tr').toggle('slow');
element.find(".table-expandable-arrow").toggleClass("up");
});
table.children('tbody').children('tr').filter(':even').each(function() {
var element = $(this);
element.append('<td><div class="table-expandable-arrow"></div></td>');
});
});
我尝试添加在另一块逻辑的事件,但没有奏效:
table.children('tbody').children('tr').filter(':even').find('.table-expandable-arrow').click(function() {
什么,我可以尝试有什么想法的箭头被触发,而不是整个的行?
更新:
<tr class="primaryValue ">
<td class="small"><a target="_BLANK" href="tool.php?tool=30">30</a></td>
<td class="small">Quickload</td>
<td class="small">Web</td>
<td class="small">John Doe</td>
<td class="small"><a href="mailto:[email protected]">[email protected]</a></td>
<td class="small">Omaha</td>
<td class="small">123456</td>
<td class="small">N/A</td>
<td>
<div class="table-expandable-arrow"></div>
</td>
</tr>
你的html的结构是什么? “扩展箭头”是什么元素? – Dekel
@Dekel为行添加了一小段代码 – SBB
有没有提供小提琴的机会? – Aer0