Answers for "print page using js"

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

Code answers related to "Javascript"

Browse Popular Code Answers by Language