THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML onpause Attribute


Definition and Usage

The onpause attribute defines a script to be run when the audio/video is paused either by the user or programmatically.

Tip: The onplay attribute is used to define a script to run when the audio/video has been started or is no longer paused.


Applies to

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

Elements Event
<audio> pause
<video> pause

Examples

Audio Example

Run "myFunction" if the audio is paused:

<audio onpause="myFunction()">
Try it Yourself »

Video Example

Run "myFunction" if the video is paused:

<video onpause="myFunction()">
Try it Yourself »

Browser Support

The onpause attribute has the following browser support for each element:

Element
audio Yes 9.0 Yes Yes Yes
video Yes 9.0 Yes Yes Yes