I need to make an "Print product" feature on my emerce site and the print part i already figured it out ... windows.print
My problem is that I want to copy the entire content of DIV where I have all product specifications and photos to another window which after I can print it.
I have a link Print this product which when clicked, JQUERY must create the new window and also copy the entire product's DIV to this new window.
I have seen several approaches here and it only confused me so that's why I am posting this here.
Can someone please explain me with an example how to solve my problem.
Thank you.
I need to make an "Print product" feature on my emerce site and the print part i already figured it out ... windows.print
My problem is that I want to copy the entire content of DIV where I have all product specifications and photos to another window which after I can print it.
I have a link Print this product which when clicked, JQUERY must create the new window and also copy the entire product's DIV to this new window.
I have seen several approaches here and it only confused me so that's why I am posting this here.
Can someone please explain me with an example how to solve my problem.
Thank you.
Share Improve this question asked Jan 23, 2012 at 13:35 Arizona2014Arizona2014 1,3472 gold badges18 silver badges33 bronze badges 02 Answers
Reset to default 4Just get the content and set it in the new place:
var w = window.open();
w.document.body.innerHTML = window.document.getElementById('print').innerHTML;
Here is demo
Well I think that this plugin of jquery might help you.
http://projects.erikzaadi./jQueryPlugins/jQuery.printElement/