dynamicweb/digitalglarus/static/digitalglarus/js/utils.js

22 lines
No EOL
410 B
JavaScript

$( document ).ready(function() {
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
$('.print').on('click', function(e){
printDiv(e.target.getAttribute("data-print") );
});
});