How to print contents of a div, and not the whole window

window.print prints the contents of the entire browser window. I want to be able to print the contents of a specific div.

Related tags: JavaScript

var w = window.open();
w.document.write(jQuery(this).html());
w.print();
w.close();

Rating: 1

Propose a different solution...