How do I print the indicated div (without manually disabling all other content on the page)?
I want to avoid a new preview dialog, so creating a new window with this content is not useful.
The page contains a couple of tables, one of them contains the div I want to print - the table is styled with visual styles for the web, that should not show in print.
hm ... use the type of a stylsheet for printing ... eg:
print.css:
With jQuery it's as simple as this:
In my case I had to print a image inside a page. When I used the solution voted, I had 1 blank page and the other one showing the image. Hope it will help someone.
Here is the css I used:
My html is:
If you only want to print this div, you must use the instruction:
I tried many of the solutions provided.None of them worked perfectly. They either lose CSS or JavaScript bindings. I found a perfect and easy solution that neither losses CSS nor JavaScript bindings.
HTML:
Javascript:
This works well:
Note that this only works with "visibility". "display" won't do it. Tested in FF3.