Print pages in JavaScript
Many times you will love to put a button on your website to print the content of that page through a printer. JavaScript helps you perform this function by using the print function of the window object.
The window.print () function in JavaScript prints the current page when executed. You can call this function directly using the onclick event as in the following example:
For example
Try the following example:
- Learn about ES6 in Javascript
- What is JavaScript?
- Udemy's top 5 JavaScript courses
- How to Turn on JavaScript
- How to Enable JavaScript
- What is Currying in Javascript? How to use Currying in JavaScript
- Things to know about 'this' in JavaScript
- ! = and! == What is the difference in JavaScript?
- Top site with many good JavaScript exercises to practice
- Document Object Model (DOM) in JavaScript