我有以下 html 代码,它代表表格的一部分
<tr>
<td>
<span class='tip'><a href='#' class='Delete' data-name='product1' title='Delete'><img src='images/icon/icon_delete.png'></a></span>"
</td>
</tr>
<tr>
<td>
<span class='tip'><a href='#' class='Delete' data-name='product2' title='Delete'><img src='images/icon/icon_delete.png'></a></span>"
</td>
</tr>
和一些 JS
$(document).on('click', '.Delete', function () {
var name = $(this).attr("data-name");
$.confirm({
'title': 'DELETE ROW',
'message': "<strong>DO YOU WANT TO DELETE </strong><br /><font color=red>' " + name + " ' </font> ",
'buttons': {
'Yes': {
'class': 'special',
'action': function () {
// this is the problem
// i am trying to get the row
var row = $(this).closest("tr").get(0);
oTable.fnDeleteRow(row);
}
},
'No': { 'class': '' }
}
});
});
我正在尝试获取行 ID,以便能够将其删除。我如何将调用者传递给click
事件
编辑:我正在尝试删除一行,也许还有其他方法