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 :: js parse cookie string 
Javascript :: nods js fs append to file 
Javascript :: set radio button checked jquery 
Javascript :: when was react invented 
Javascript :: jquery on input 
Javascript :: node js sublime text 
Javascript :: bash parse json 
Javascript :: event listener for element lost focus 
Javascript :: readline sync javascript 
Javascript :: sorting disable in datatable bootstrap 
Javascript :: javascript loop over classes 
Javascript :: how to capitalize string in javascript 
Javascript :: jquery selector all elements except one 
Javascript :: javascript loop through object 
Javascript :: js find object from value in array 
Javascript :: corresponding text to key code js 
Javascript :: javascript execute code on page load 
Javascript :: : not foundram Files/nodejs/npm: 3: 
Javascript :: remove whitespace javascript 
Javascript :: id of other schema type mongoose 
Javascript :: jquery get relative position of element 
Javascript :: dm someone by id discord.js 
Javascript :: async fetch api call 
Javascript :: set focus on input field javascript 
Javascript :: copy object javascript 
Javascript :: fetch data from api in react 
Javascript :: Ready check failed: NOAUTH Authentication required. 
Javascript :: javsacript split string at position 
Javascript :: A form label must be associated with a control react 
Javascript :: react native scrollview sticky header 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =