I've this function for my Wordpress plugin uses jQuery that prints the content from the div with class "table_disp". How can I print the css style along with it.
function pop_print(){
w=window.open(null, 'Print_Page', 'scrollbars=yes');
w.document.write(jQuery('.table_disp').html());
w.document.close();
w.print();
}
Any idea?
You need to include the SAME stylesheet you're using in the parent page within the pop-up. You may want to make a dummy page stub/wrapper that has your stylesheet in it, then inject your HTML.
var myStyle = '<link rel="stylesheet" href="http://mysite.com/mystyle.css" />';
w.document.write(myStyle + jQuery('.table_disp').html());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With