Print Specific Element With CSS - jQuery divjs

File Size: 7.61 KB
Views Total: 12347
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Print Specific Element With CSS - jQuery divjs

divjs is a lightweight and easy jQuery element printing plugin which allows the user to print only a selected HTML element with additional CSS styles.

How to use it:

1. To use the element printing plugin, load the main JavaScript file divjs.js after jQuery.

<script src="" 
<script src="divjs/divjs.js"></script>

2. Attach the function printElement to the element you want to print. That's it.


3. Customize the title of the document.

  title: 'Custom Title Here'

4. Apply CSS files and styles to the print document.

  • extend: all the CSS files and inline styles
  • style: only inline styles
  • link: only CSS links
  css: 'extend'

5. Apply inline CSS styles to the print document.

  ecss: 'CSS rules here'

6. Apply external CSS files to the print document.

  lcss: ['example.css', '/path/to/print.css']

7. Define an array of elements to hide while printing.

  keepHide: []

8. Set the wrapper for print.

<p id="contacts">All the contacts are going to be print.<p>
<button id="printer">Print</button>

  <h1>Somethig goes before the printer element</h1>
  <div id="wrapper"></div>
  <p>Footer after the wrapper</p>
$('#printer').on('click', function(event){
    wrapper: {
      wrapper: $('#selector'),
      selector: '#wrapper'


v0.1.1 (2019-08-24)

  • Clean up.

v0.1.0 (2019-07-17)

  • Added wrapper functionality for print

This awesome jQuery plugin is developed by zxalif. For more Advanced Usages, please check the demo page or visit the official website.