// 1. buttonNameSelectAsCssHere
// 2. printAreaIdNameHere
const printBtn = document.querySelector("buttonNameAsCssHere");
printBtn.addEventListener("click", function () {
printArea("printAreaIdNameHere");
window.location.reload();
});
function printArea(areaId) {
var printContents = document.getElementById(areaId).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
};
Step 1:
Step 2:
Step 3: