Created
August 12, 2021 12:22
-
-
Save Merazsohel/ea7a2fa1731da176812918cd92c2c5d6 to your computer and use it in GitHub Desktop.
JS Print Div
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 printDiv(divName) { | |
var printContents = document.getElementById(divName).innerHTML; | |
var originalContents = document.body.innerHTML; | |
document.body.innerHTML = printContents; | |
window.print(); | |
document.body.innerHTML = originalContents; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment