Print method in javascript

print() method in javascript

print() method is used to open print dialog and print a current whole document or part of a document.

Example

Try Yourself

Some browser will block while the print dialog window is open.


@media print

This is used to apply specified css property while print the document.

Example

Try Yourself

Print by id value

We can print the part of document by using like below.

Example

Try Yourself