Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

oncut event

oncut event

Event Object Reference Event Object

Example

When Execute JavaScript when the selected content in the element is cut:

Try it »

See more examples at the bottom of this article.


Definition and Usage

The oncut event is triggered when the user cuts the content of an element.

Note: Although all used HTML elements support the oncut event, not all elements are actually supported, for example the element,

unless contenteditable is set to "true" (see more examples below).

Tip: The oncut event is usually applied to type="text" element.

Tip: There are three ways to cut content:


Browser support

Events
oncut Yes Yes Yes Yes Yes

Syntax

In HTML:

<

element

oncut="

myScript

">

Try it

In JavaScript:

object

.oncut=function(){

myScript

};

Try it

In JavaScript, use the addEventListener() method:

object

.addEventListener("cut",

myScript

);

Try it

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


Technical Details

Does it support bubbling: Yes
Is it cancelable: Yes
Event type: ClipboardEvent
Supported HTML tags: All HTML elements

More examples

Example

Execute JavaScript when cutting the text content on the element (note that contenteditable is set to "true"):

the text content on the element to execute JavaScript (note that contenteditable is set to "true"):

Try to cut this text

Try it »


Related pages

HTML DOM Reference Manual: oncopy event

HTML DOM Reference Manual: onpaste event

Event Object Reference Event Object