<script type="text/javascript">
function printContent(el) {
var restorepage = document.body.innerHTML;
var printcontent = document.getElementById(el).innerHTML;
document.body.innerHTML = printcontent;
window.print();
document.body.innerHTML = restorepage;
}
</script>
<div id="div1" class="block">
some text..............
</div>
<button class="btn btn-success" type="button" onclick="printContent('div1')" style="width: 60px;">
Print
</button>
function printContent(el) {
var restorepage = document.body.innerHTML;
var printcontent = document.getElementById(el).innerHTML;
document.body.innerHTML = printcontent;
window.print();
document.body.innerHTML = restorepage;
}
</script>
<div id="div1" class="block">
some text..............
</div>
<button class="btn btn-success" type="button" onclick="printContent('div1')" style="width: 60px;">
</button>
No comments:
Post a Comment