jQuery - printing dynamic content - replacing in clone
===

I want to print a page where content is dynamically added. I try to do it like this:

    $("body").on("click", function() {
    
        function preparePrint() {
            var print_window = window.open();
            var print_document = $("div.container").clone();
            
            print_document.find('.block').each(replaceWith("X"));
        
            print_window.document.open();
            print_window.document.write(print_document.html());
            print_window.document.close();
            print_window.print();
            print_window.close();
        }
        
        $("#print").click(function() {
            preparePrint();
        })
    })

With every click, the contents of the `div` with class `container` are cloned. `container` holds some `div`s and tables. In the clone, I try to find elements with the class `block` and replace them with an upper case "X". `block` is the class that is dynamically added to some `td`s. 

Then, I open a new window and place the html content of the clone in there. Then I print it.

So far, so good, but the replacing is not working - why? I also tried `document.write`, `html()` and `text()` to get the "X" in there, but without effect. I always end up with a white page, so maybe there is something wrong with the clone also.