Bharanikumar Bharanikumar - 1 year ago 103
Javascript Question

jquery print selected div instead complete page

i have two div,

div1 and div2 ,
maintaining the original css styles applied to the div2 element being printed.

i dont want to print content inside the div1 ,

i want to take only inside the div2 ,

How to print , using jquery/javascript ,

Answer Source

Try this

<style type="text/css">
@media print
body * { visibility: hidden; }
.div2 * { visibility: visible; }
.div2 { position: absolute; top: 40px; left: 30px; }