Window: paste event

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.

We'd love to hear more about your role and the company you work for
Please help us by answering a few questions.

The paste event is fired when the user has initiated a "paste" action through the browser's user interface.

The original target for this event is the Element that was the intended target of the paste action. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: paste event.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

js
addEventListener("paste", (event) => {});

onpaste = (event) => {};

Event type

Examples

js
window.addEventListener("paste", (event) => {
  console.log("paste action initiated");
});

Specifications

Specification
Clipboard API and events
# clipboard-event-paste
HTML
# handler-onpaste

Browser compatibility

See also