片段之一刪除錶行:通過選擇錶行的單元格
$(document).ready(function() {
$('button').click(function() {
$('table').append("<tr><td id='no'>X</td><td>Example</td></tr>")
});
$('th').on('click', '#no', function() {
$(this).remove();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr>
<th>Delete</th>
<th> Element</th>
</tr>
<tr>
<td id='no'>X</td>
<td>Example</td>
</tr>
</table>
<br>
<button>
More
</button>
我想,當我點擊該行的X要刪除的行。我應該添加哪些代碼來執行此操作?
[刪除表的可能的複製行後單擊表格行刪除按鈕](https://stackoverflow.com/questions/11553768/remove-table-row-after-clicking-table-row-delete-button) – Sand