Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

print webpage in javascript

window.print() 
Comment

print page in javascript

<button onclick="window.print()">print</button>
Comment

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', '');    
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: react hooks component re render when button press 
Javascript :: classlist 
Javascript :: javascript stop each loop 
Javascript :: path.join nodejs 
Javascript :: watch file in changes in webpack 
Javascript :: 100vh mobile 
Javascript :: static variable in javascript 
Javascript :: javascript set object key by variable 
Javascript :: iterate through an array 
Javascript :: int to string javascript 
Javascript :: overflow scroll react native 
Javascript :: javascript get fibonacci number 
Javascript :: get last index of array of objects javascript 
Javascript :: how to import a json string from a file in typescript 
Javascript :: promise.all 
Javascript :: joi validation enum 
Javascript :: node-json-db 
Javascript :: javascript onclick append a new row to table 
Javascript :: adjust color of text js javascript 
Javascript :: JS iterate over an array 
Javascript :: round number to 2 symbols after comma 
Javascript :: js var vs const 
Javascript :: javascript read text file from url 
Javascript :: jquery get all classes of a div 
Javascript :: for loop in shopify liquid template 
Javascript :: javascript Set Intersection Operation 
Javascript :: adding a timer in a quiz game 
Javascript :: twilio sms sending in express 
Javascript :: what is callback in js 
Javascript :: json data example 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =