The contents of the following div is derived dynamically: i.e a table is added dynamically to this div with some button.
My question is how to print the content of this div(window.print) and not other things in the page
<div id="newdiv" name="newdiv"></div>
Thanks.
Two ideas:
Introduce a print stylesheet
that will give every element
display: noneexcept fornewdiv:I can’t test this right now but I can’t see why this wouldn’t work.
Copy the contents of the
divinto a newly creatediframeelement using JavaScript and print that.Lots of obstacles on the road that way, though. I’d try using CSS first.