I tried several stuff I found now, but nothing seems to work for me.
On my site I got two tables. In one of them are entries with a button in the last column "add" which deletes the row from that table and moves it to the other table. When this happens I want to edit the content of that last <td>, so that there will be an "delete" button, which moves the entry back to the first table.
$("#questiontable").on('click', '.btnDelete', function () {
var question_id = $(this).val();
var tr = $(this).closest('tr').remove().clone();
tr[4].html("<button>delete</button>");
tr.appendTo("#currentquestiontable");
});
The td looks like this before:
<td>
<input type="hidden" name="id" value= {{question.id}} />
<button class="btnDelete">Hinzufügen</button>
</td>