Why are you replacing the entire document body?
Apr 10, 2017
8
Level 1
window.print not working after clicking once
Hi. I have a print page button but it's not working after clicking once. This is my code
$('body').css('overflow', 'hidden');
$('html').animate({ scrollTop: 0 }, 'fast', 'swing', function () {
var printContents = document.getElementById("shipping-reservation-
summary").innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
return false;
})
Please or to participate in this conversation.