Window print() Method In Javascript

Window print() Method In Javascript

Usage and Definition

The print() method prints the contents of the current web page.

<!DOCTYPE html>
<html>
<body>
<p>Click the button to print the current page.</p>
<button onclick="yourFunction()">Print</button>
<script>
function yourFunction() {
  window.print();
}
</script>
</body>
</html>

 

2020-01-16