Latest web development tutorials

oncut event

Event Object Reference Event objects

Examples

JavaScript is executed when the <input> element in the choice of content is cut:

<Input type = "text" oncut = "myFunction ()" value = "attempts to cut the text">

try it"

See more examples at the bottom of this article.


Definition and Usage

oncut event is triggered when the contents of the user shear element.

Note: While HTML elements use support oncut events, but in fact does not support all elements such as <p> element, unless the (See below for more examples) contenteditable as "true".

Tip: oncut event usually used in type = "text" of the <input> element.

Tip: There are three ways you can cut content:

  • Press CTRL + X
  • Select "Cut (Cut)" from your browser's Edit menu
  • Right-click the mouse button to select "Cut (Cut)" command in the context menu.

Browser Support

event
oncut Yes Yes Yes Yes Yes


grammar

In HTML:

<Elementoncut = "myScript"> try

In JavaScript:

object .oncut = function () {myScript }; try

JavaScript, use the addEventListener () method:

object .addEventListener ( "cut", myScript ); try

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


technical details
Whether to support the bubble: Yes
It can be canceled: Yes
Event Type: ClipboardEvent
Supported HTML tags: All HTML elements


Examples

More examples

Examples

JavaScript is executed when the text Cut <p> element on (note contenteditable set to "true"):

<P contenteditable = "true" oncut = "myFunction ()"> try to cut the text </ p>

try it"


Related Pages

HTML DOM Reference: oncopy event

HTML DOM Reference: onpaste event


Event Object Reference Event objects