-2

I have a page with a modal. One option in this modal is to print the page using window.print().

This prints the modal and not the page.

How can I print just the page and not the modal?

dingdingding
  • 1,411
  • 1
  • 15
  • 23
  • @Roko C. Buljan Hi. It's not my fault my Google-fu is not on par with yours. This is of course going to get buried but there's no reason to leave condescending aggressive messages before you mark something as duplicate. – dingdingding Feb 13 '18 at 00:24

1 Answers1

2

You want to set up a print stylesheet. If your modal content has an ID of #modal, then this will hide it when printed:

@media print {
    #modal{
        display: none;
    }
}
koosa
  • 2,966
  • 3
  • 31
  • 46