Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: userc865b
Added: Jun 12, 2018 12:52 PM
Views: 13
Tags: js
  1. function printDiv(divName) {
  2.         var printContents = document.getElementById(divName).innerHTML;
  3.         var originalContents = document.body.innerHTML;
  4.  
  5.         document.body.innerHTML = printContents;
  6.  
  7.         window.print();
  8.  
  9.         document.body.innerHTML = originalContents;
  10.     }