I have created a button that when you click it, it will open up a window to print a specific div (the todos div).
See images bellow:
As you can see when I click the print button, it displays only the the todos without the applied css. How can I do this?
JS for print button:
<script type="text/javascript">
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
w=window.open();
w.document.write(printContents);
w.print();
w.close();
}
</script>
HTML for the print button:
<input type="button" id="print-btn" onclick="printDiv('printArea')" value="print a div!"/>