I want different colors for alternate table rows even when i delete a row in middle.
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> 
Jquery
$(function(){
    update_rows();
    $("a").click(function(){$(this).parent().parent().remove();update_rows();});
});
function update_rows()
{
    $("tr:even").css("background-color", "#aaa");
    $("tr:odd").css("background-color", "#eee");
}
css
.sam
{
background-color:#FF00FF;
}
.sams
{
background-color:#0000FF;
}
the above code change the row color but not the cell which has link. Please help me to solve the problem
 
     
     
     
     
    