Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Partial Print Document Tutorial HTML div Content

Published :
Author :
Adam Khoury
Learn to allow users to print specific parts of your documents instead of printing the entire web page. We will apply print buttons near each printable portion of the document. <!DOCTYPE html> <html> <head> <script> function printContent(el){ var restorepage = document.body.innerHTML; var printcontent = document.getElementById(el).innerHTML; document.body.innerHTML = printcontent; window.print(); document.body.innerHTML = restorepage; } </script> </head> <body> <h1>My page</h1> <div id="div1">DIV 1 content...</div> <button onclick="printContent('div1')">Print Content</button> <div id="div2">DIV 2 content...</div> <button onclick="printContent('div2')">Print Content</button> <p id="p1">Paragraph 1 content...</p> <button onclick="printContent('p1')">Print Content</button> </body> </html>