It looks like you call einfugen more than once. If you only call it once, it will work ( Demo ).
EDIT: From your update, yes, you bind the listener every time you click the add link. You are misleading an action that would be reasonable in an onclick to associate a listener with a fire in this event.
Your insertAfter does not start when einfugen starts. einfugen simply adds a listener that instructs that this code is einfugen whenever a click occurs. So the call can be made once, initially, and then your listener will always be there. It should not be added each time you click.
You can first link the listener like this:
$(function() { $('#append_tr').bind('click', function(){ $('<tr><td>new td</td></tr>').insertAfter('#append_tr'); }); });
Where $(function() { ... }); is a shorthand for running a function on DOMReady , i.e. as soon as all DOM nodes are available to access the script.
Demo
source share