Skip to content

Instantly share code, notes, and snippets.

@clairtonluz
Created September 17, 2019 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clairtonluz/20d4675a308c21f3c882c234ae085ec7 to your computer and use it in GitHub Desktop.
Save clairtonluz/20d4675a308c21f3c882c234ae085ec7 to your computer and use it in GitHub Desktop.
function printById(elementId) {
var popup = window.open();
popup.document.write(document.getElementById(elementId).outerHTML);
popup.focus(); //required for IE
popup.print();
popup.close();
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment