Hello,
I want to print div contents without opening new window. how i create this ?
I used following code-
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="jquery.print.js"></script>
This two js kill my own js files.
I want simple code without using js reference. and without open new window for printing.
<script type="text/javascript">
$("#btnPrint").live("click", function () {
var divContents = $("#div1").html();
var printWindow = window.open('', '', 'height=400,width=800');
printWindow.document.write('<html><head><title>DIV Contents</title>');
printWindow.document.write('</head><body >');
printWindow.document.write(divContents);
printWindow.document.write('</body></html>');
printWindow.document.close();
printWindow.print();
});
</script>