SO - 20995526
by Arun P Johny
HTML
<table border="1">
<tr>
<td>Row 1</td>
<td><a class="sam" href="#">Delete</a>
</td>
</tr>
<tr>
<td>Row 2</td>
<td><a class="sams" href="#">Delete</a>
</td>
</tr>
<tr>
<td>Row 3</td>
<td><a class="sam" href="#">Delete</a>
</td>
</tr>
<tr>
<td>Row 4</td>
<td><a class="sams" href="#">Delete</a>
</td>
</tr>
<tr>
<td>Row 5</td>
<td><a class="sam" href="#">Delete</a>
</td>
</tr>
</table>
CSS
tr:nth-child(odd) a {
background-color:#FF00FF;
}
tr:nth-child(even) a {
background-color:#0000FF;
}
tr:nth-child(odd) {
background-color:#aaa;
}
tr:nth-child(even) {
background-color:#eee;
}
JavaScript
$(function () {
$("a").click(function () {
$(this).closest('tr').remove();
});
});