YouTip LogoYouTip

Event Onpause

onpause Event |

-- Learning is not just about technology, but also about dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

HTML DOM Attribute Object

HTML DOM Console Object

onpause Event

Event Object Reference Event Object

Example

Execute JavaScript when the video is paused:

<video onpause="myFunction()">

Try it yourself Β»

More examples are included at the bottom of this page.


Definition and Usage

The onpause event occurs when a video or audio is paused.

Tip: The onplay event occurs when a video or audio starts playing.


Browser Support

The numbers in the table specify the first browser version that fully supports the event.

Event
onpause Yes 9.0 Yes Yes Yes

Syntax

In HTML:

<element onpause="myScript">

Try it yourself

In JavaScript:

object.onpause=function(){myScript};

Try it yourself

In JavaScript, using the addEventListener() method:

object.addEventListener("pause", myScript);

Try it yourself

Note: Internet Explorer 8 and earlier IE versions do not support the addEventListener() method.


Technical Details

Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <audio>, <video>

More Examples

Example

Execute JavaScript when the audio is paused:

<audio onpause="myFunction()">

Try it yourself Β»


Event Object Reference Event Object

HTML DOM Attribute Object

HTML DOM Console Object

ByteDance Coding Plan supports mainstream large models like Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., officially supplied, stable and reliable.

← Event AnimationiterationHashes Hget β†’