Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print all div content with jquery printElement

I am trying to print my div content using printElement plugin. The div has a lot of text with in so there is a scrollbar. The problem is that plugin prints only the part of text which is actually on the screen. How can I print all of the text?

EDIT:

I need a solution which will print this div with styles which are in external css.

like image 995
szaman Avatar asked Feb 08 '11 11:02

szaman


People also ask

How do I print the content of a div?

To print the content of div in JavaScript, first store the content of div in a JavaScript variable and then the print button is clicked. The contents of the HTML div element to be extracted.

How do I print something using jQuery?

jQuery Code:click(function(){ window. print(); return false; });

What is $() in jQuery?

The jQuery syntax is tailor-made for selecting HTML elements and performing some action on the element(s). Basic syntax is: $(selector).action() A $ sign to define/access jQuery. A (selector) to "query (or find)" HTML elements. A jQuery action() to be performed on the element(s)


2 Answers

Have a look at this:

http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm

like image 125
benhowdle89 Avatar answered Sep 21 '22 23:09

benhowdle89


https://github.com/jasonday/printThis

Configurable with additional css files, and other options.

like image 21
Jason Avatar answered Sep 20 '22 23:09

Jason