Answers for "window print html"

1

javascript window.print

<button onclick="window.print()">Print this page</button>
Posted by: Guest on May-27-2021
0

print page using js

$('.print-btn').click(function(){
  var printed_id = $(this).attr('data-id');
  if( printed_id ){
    var printed_content = $($('#' + printed_id).html());
    $('body').children().css('display', 'none');
    $('body').append(printed_content);
    window.print();
    printed_content.remove();   
    $('body').children().css('display', '');    
  }
});
Posted by: Guest on July-12-2021

Browse Popular Code Answers by Language