Snippet:
$(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>
I want a row to be deleted when I click the X on that row. What code should I add to do so?