Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Waiting for user confirmation] Ho To Add a Print Button

$
0
0

Hi CaridadZ

I would really appreciate it if you can have a look at the Coupon Template I have created. I am trying to print the coupon details only instead of the whole page.
I put the content temple in a division as:
<div id="printableArea">
//Content
</div>

<input type="button" onclick="printDiv('printableArea')" value="print a div!" />

Then I added the JS script in the JS Editor section:

function printDiv(printableArea) {
var printContents = document.getElementById(printableArea).innerHTML;
var originalContents = document.body.innerHTML;

document.body.innerHTML = printContents;

window.print();

document.body.innerHTML = originalContents;
};

However, it does not seem to work? (HTML <input> just disappears and nothing seem to happen)

Thanks


Viewing all articles
Browse latest Browse all 20145

Trending Articles