Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML onafterprint Attribute


Definition and Usage

The onafterprint attribute fires when a page has started printing, or if the print dialogue box has been closed.

Tip: The onafterprint attribute is often used together with the onbeforeprint attribute.


Applies to

The onafterprint attribute is part of the Event Attributes, and can be used on the following element:

Elements Event
<body> onafterprint

Example

Execute a JavaScript when a page has started printing, or if the print dialogue box has been closed:

<body onafterprint="myFunction()">
Try it Yourself »

Browser Support

Event Attribute
onafterprint 63 Yes Yes Not supported Not supported

Note: In IE, the onafterprint attribute occurs before the print dialogue box, instead of after.