Trying To Print The Contents In A New Window
I am trying to print the html contents to a new window. var w= window.open(); var htmlContent = $(printdiv).html(printcontent); $(w.document.body).html(htmlContent); $(w).location.
Solution 1:
Try setting new window
name reference , removing $()
wrapper around w
at .focus()
, .print()
, .close()
as jQuery()
does not have method .print()
calling .print()
chained to $()
would return TypeError: undefined is not a function
// set `w` name referencevar w = window.open("", "w");
var htmlContent = $(printdiv).html(printcontent);
$(w.document.body).html(htmlContent);
// $(w).location.reload();
w.focus();
w.print();
w.close();
jsfiddle http://jsfiddle.net/14f5owux/
Post a Comment for "Trying To Print The Contents In A New Window"