Description
Here i will explain how to print specific element using javascript in our website.
It is simple and small code to print your element from web application.
Just you need to pass element id parameter like the following javascript function:
Here i will explain how to print specific element using javascript in our website.
It is simple and small code to print your element from web application.
Just you need to pass element id parameter like the following javascript function:
<script type="text/javascript">
function printDiv(divID) {
//Get the HTML of div
var divElements =
document.getElementById(divID).innerHTML;
//Get the HTML of whole page
var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML = divElements;
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = oldPage;
}
</script>
nice one
ReplyDelete