您好我有一个下表输出数据行。每行旁边都有一个删除按钮。
<form>
<table id="tblAppendGrid" class="appendGrid">
<thead class="ui-widget-header">
<tbody class="ui-widget-content">
<tr id="tblAppendGrid_Row_1">
<td><input type="text" id="tblAppendGrid_s_1" name="nameCompany" maxlength="100" style="width: 160px;"></td>
<td><button id="tblAppendGrid_Delete_1" class="delete ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" value="2" type="text" title="Remove Current Row" tabindex="-1" role="button" aria-disabled="false"></td>
<tr id="tblAppendGrid_Row_2">
<td><input type="text" id="tblAppendGrid_s_2" name="nameCompany" maxlength="100" style="width: 160px;"></td>
<td><button id="tblAppendGrid_Delete_2" class="delete ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" value="2" type="text" title="Remove Current Row" tabindex="-1" role="button" aria-disabled="false"></td>
</tbody>
<tfoot class="ui-widget-header">
</table>
</form>
单击删除按钮时,我试图读取一行。在下面的代码中,我不知道如何选择按钮 ID 旁边的行号。因此,它不起作用。
$(document).ready(function () {
$("#tblAppendGrid_Delete_").button().click(function () {
testing("in delete");
});
});
我想我需要选择器像 $("tblAppenDGrid_Delete_2")。...请让我知道如何在单击按钮时选择此行,以便将其删除。谢谢