JQuery print part of div only
Posted in JQuery, Uncategorized on May 19th, 2010 by taswar
So here is an interesting jquery plugin called jqprint it allows one to specify any element and sent it to print.
Assuming you have an element with id printButton and a content area called divToPrint
1 2 3 | $('#printButton').live('click', function() { $('#divToPrint').jqprint(); }); |
This will pop up the print functionality in your browser and send it with the default media=”print” css or else it picks up your default css. Kind of neat.
One thing to be mindful of in Firefox is the overflow attribute in your css stylesheet if you have overflow: hidden you will only get one page to print only.
Example:
1 | body { overflow: hidden; } |
Remove the overflow and it would print all the pages of a div.
One Response
Leave a Comment

September 5th, 2010 at 10:16 am
demo page will be helpful