I want to print the content of a div using jQuery. This question is already asked in SO, but I can\'t find the correct (working) answer.
This is is my HTML:
Some jQuery research has failed, so I moved to JavaScript (thanks for your suggestion Anders).
And it is working well...
HTML
This is a sample text for printing purpose.
Do not print.
JavaScript
function printDiv()
{
var divToPrint=document.getElementById('DivIdToPrint');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write(''+divToPrint.innerHTML+'');
newWin.document.close();
setTimeout(function(){newWin.close();},10);
}