Last active
February 20, 2018 02:43
-
-
Save sayham-sjb/470dedf373ae263d7b2ed749ff7423d2 to your computer and use it in GitHub Desktop.
HowToPrintContentsFromCertainDIV_printSpecificDiv2 #js #VS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function printSpecificDiv(divID) { | |
var divElements = document.getElementById(divID).innerHTML; | |
var wholePage = document.body.innerHTML; | |
document.body.innerHTML = "<html><head><title></title></head><body>" | |
+ divElements + "</body>"; | |
window.print(); | |
document.body.innerHTML = wholePage; | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment