W3cubDocs

/Web APIs

Document: cut event

The cut event fires when the user initiates a cut action through the browser's user interface.

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

Syntax

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

js

addEventListener("cut", (event) => {});

oncut = (event) => {};

Event type

Examples

To be informed when a user cuts data from the webpage to their clipboard, you can add a handler to your Document instance using addEventListener(), like this:

js

document.addEventListener("cut", (event) => {
  /* the session has shut down */
});

Alternatively, you can use the Document.oncut event handler property to establish a handler for the cut event:

js

document.oncut = (event) => {
  /* the session has shut down */
};

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
cut_event 1 12 22
9Before Internet Explorer 9, this event is not supported via addEventListener; however, the event handler is supported since IE 5.5. The event can be listened to via element.oncopy.
≤12.1 3 4.4 18 22 ≤12.1 3 1.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/cut_event