javascript - How to print the pop up window content with the main content -


i want print content of page. contain popup. need display pop window content in main page contain button name details. when click button pop show.

when click print button.only show main content. particular field pop displaying window blank (details button)

i'm using window.print();

print button=> 'onclick="printpage()"'

function

function printpage() {     $('#hiddendiv').html($('#view_popup_descriptive_index').html());      $('#hiddendiv').show();     window.print();     $('#hiddendiv').hide(); } 

any method display popup content.

you may try appending html popup page before printing.

$("#print").on('click', function(){     //find html   var $popupcontent = $('.popup').html();    //console.log($popupcontent); //see popup    //create div before button , put popup content there   $(this).before($('<div />', {     'class': 'created',     'html': $popupcontent   }));    //trigger printing   window.print();    //remove dynamically created container   $('.created').remove(); }) 

you can see working online here - https://jsfiddle.net/skip405/6dt2dhm7/


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -