HTML



class="print-btn" onclick="PrintElem('printtest')">Print

Javascript


function PrintElem(elem)
{
var mywindow = window.open('', 'PRINT', 'height=400,width=600');
mywindow.document.write('' + document.title + '');
mywindow.document.write('');
mywindow.document.write('

' + document.title + '

');
mywindow.document.write(document.getElementById(elem).innerHTML);
mywindow.document.write('');

mywindow.document.close(); // necessary for IE >= 10
mywindow.focus(); // necessary for IE >= 10*/

mywindow.print();
mywindow.close();

return true;
}