I have a page with a couple of ads that sometimes pop up and also has a form on it. What I want to do is use something like onbeforeprint to detect and remove the ads, form submit and reset buttons and replace the textboxes with strings. But after the user closes the print dialog (I do not care if it is by canceling or clicking print) the ads come back and the form is remade.
Asked
Active
Viewed 305 times
0
-
Make sure you get paid for printed ads, and print the ads automatically with window.print everytime someone moves the mouse. – adeneo Jul 17 '13 at 15:31
1 Answers
2
You can simply hide them using the following CSS...
@media print {
input, .ads-class
{
display:none
}
}
Obviously edit the selector to suit your needs. This way you don't need to worry about adding things back after printing.

Reinstate Monica Cellio
- 25,975
- 6
- 51
- 67