Reputation: 11
How can I print a div
element with click on print button without opening print preview popup with JavaScript.
function printContent(el) {
var restorepage = document.body.innerHTML;
var printcontent = document.getElementById(el).innerHTML;
document.body.innerHTML = printcontent;
window.print();
document.body.innerHTML = restorepage;
}
Upvotes: 0
Views: 170
Reputation: 11495
No.
However, you could develop browser extension that might be capable of doing so. Thought, it would be way too much effort for little result.
Upvotes: 1