Created
December 17, 2024 05:14
-
-
Save shohag-cse-knu/307a5b7584f0e5b9fe2e8855d3e36db0 to your computer and use it in GitHub Desktop.
Print the div following by a html id with JS
This file contains hidden or 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
| //This will print the inner printarea id | |
| function print_div(){ | |
| var printContents = document.getElementById('printarea').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