suppose i have many div\'s in my page but i want to print the content of specific div using jquery. i found there is a plugin for that.
jQuery Print Element
usin
Here is a JQuery&JavaScript solutions to print div as it styles(with internal and external css)
$(document).ready(function() {
$("#btnPrint").live("click", function () {//$btnPrint is button which will trigger print
var divContents = $(".order_summery").html();//div which have to print
var printWindow = window.open('', '', 'height=700,width=900');
printWindow.document.write(' ');
printWindow.document.write('');//external styles
printWindow.document.write('');
printWindow.document.write('');
printWindow.document.write(divContents);
printWindow.document.write('');
printWindow.document.close();
printWindow.onload=function(){
printWindow.focus();
printWindow.print();
printWindow.close();
}
});
});
This will print your div in new window.
Button to trigger event