so I'm having difficulties to print a modal with it's css. I wanted to print out a modal window exactly as it shown on the screen. I've used the window.print() command or even the javasript / jquery one. but the css is not attached. instead, it prints my modal only half way through.
So, what I wanted is, this modal image : Modal Example Image
Will be printed to window.print() as what it shown on the screen. the whole modal block with the borders etc. but without the page behind it.
codes I've tried :
function printElement(elem) {
var domClone = elem.cloneNode(true);
var $printSection = document.getElementById("printSection");
if (!$printSection) {
var $printSection = document.createElement("div");
$printSection.id = "printSection";
document.body.appendChild($printSection);
}
$printSection.innerHTML = "";
$printSection.appendChild(domClone);
window.print();
}
If anyone would answer this, Thank You !