I need to print a div , which I do as follows:
function PrintElem(elem) { Popup(elem.html()); } function Popup(data) { var mywindow = window.open('', 'to print', 'height=600,width=800'); mywindow.document.write('<html><head><title></title>'); mywindow.document.write('<link rel="stylesheet" href="css/mycss.css" type="text/css" />'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.print(); mywindow.close(); return true; }
My problem is that in IE, when I click the button, nothing happens. However, it works in Chrome and Firefox. What can I do to print it correctly?
EDIT: I call print as follows:
$('#print_it').click(function(){ var element = $('#itinerario'); PrintElem(element); });
Here print_it is the button identifier.
Another thing I've seen is that after a while, Chrome, along with other browsers, tells me that the page is not responding. Why is this happening?
javascript internet-explorer printing document
JackTurky Aug 02 2018-12-12T00: 00Z
source share