I am not sure I understand fully, but maybe this will help?
function showReplyBox(itemId,parentId) { var box = $('#comment-reply-box'); var itemBox = $('#comment-item-'+itemId); var parent_id = $('#parent_id'); parent_id.val(parentId ? parentId : itemId); $("#box").hide() $('#replybox').remove().empty().append(box).append(itemBox).appendTo( document.body) } note: in your original code, you never re-added the #replybox to the DOM.