now there is a printing function that requires printing the contents of specific div blocks. I have implemented a simple version
printElement = (elementId) => {
let printElement = document.getElementById(elementId)
let newContent = printElement.innerHTML
let oldContent = document.body.innerHTML
document.body.innerHTML = newContent
window.print()
window.location.reload()
document.body.innerHTML = oldContent
}
you can print in this way, but if you click confirm or cancel the result, the page will be reloaded again. Is there a better way to print?