I have to print out a div
which I\'m doing in the following way:
function PrintElem(elem)
{
Popup(elem.html());
}
function
You MUST do a mywindow.document.close()
and you may NOT have a space in the window name
I assume you invoke PrintElem from onclick of something - if that something is a link, you need to return false in the onclick handler!
Here is how I would do it if I had to
function PrintElem(elem) {
Popup($(elem).html());
}
function Popup(data)
{
var mywindow = window.open('', 'to_print', 'height=600,width=800');
var html = ' '+
''+
''+
data+
'';
mywindow.document.write(html);
mywindow.document.close();
return true;
}
but I am not sure whether or not the window.close() will interfere with the printing
And why not
$(function() {
$('#print_it').click(function(){
popup($('#itinerario').html());
});
});