Javascript stops working after changing table with Intraweb [duplicate]

I made a small Intraweb program with a HTML template. In Delphi I fill a table with data. When clicking the table the selected row lights up, as per the JS code. When I refill the table the script stops working and the selected line does not light up. Other elements stay working.

Can anyone tell me why this is happening?

<div class="split right">
  {%lPosten%}<br><br><br><br>
</div>

<style>
 .Kies {background-color: rgb(241, 198, 132);}
</style>

<script>
  $('#Posten td').click(function () {
    var k = $(this);
    k.closest("table").find("tr.Kies").removeClass("Kies");
    k.closest("tr").addClass("Kies");

    ajaxCall("LeesRegel", "Params=" + k.closest("tr").attr('ID'))
  });
</script>