I've looked at this question: js window.open then print() and it works just fine. My challenge is that I have a lot of styling that I would like to retain in the opened print window. I've tried changing
var printWindow = window.open('', '', 'width=1000,height=700');
to
var printWindow = window.open('print.aspx', '', 'width=1000,height=700');
and then using jQuery like this:
$("#print", printWindow.document).html($("#tabContainer").html());
but the window I get opened does not contain anything from the actual print.aspx file.
Can anyone shed some light on what's going wrong?
Edit: This is weird (at least to me)... My print.aspx has this:
<body >
<div id="print">print content here...</div>
</body>
and from my calling page this works (returns 1):
alert(printWindow.document.getElementsByTagName('body').length);
but changing 'body' to 'div' makes it "fail" returning 0