Skip to content

Instantly share code, notes, and snippets.

@sourovroy
Created July 26, 2017 09:16
Show Gist options
  • Save sourovroy/23b1bd7781f3db267229c4971ad882b4 to your computer and use it in GitHub Desktop.
Save sourovroy/23b1bd7781f3db267229c4971ad882b4 to your computer and use it in GitHub Desktop.
Print a element
var PrintContent = jQuery("div.col-sm-12 > div.inner"),
PrintContentClone = PrintContent.clone();
$('<iframe>', {
name: 'myprintiframe',
class: 'productPrintFrame'
})
.appendTo('body')
.contents().find('body')
.append(PrintContentClone);
window.frames['myprintiframe'].focus();
window.frames['myprintiframe'].print();
setTimeout(function(){ $(".productPrintFrame").remove(); }, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment