VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-oncut-event/

⇱ HTML DOM oncut Event - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM oncut Event

Last Updated : 30 Jun, 2023

The HTML DOM oncut Event occurs when the content of an element is cut by the user. The oncut event is mostly used on elements with type="text".

Supported Tags

  • It supports all HTML elements.

Syntax:

In HTML: 

<element oncut="myScript">

In JavaScript: 

object.oncut = function(){myScript};

In JavaScript, using the addEventListener() method:  

object.addEventListener("cut", myScript);

Note: There are three ways to cut the content of an element: 

  • Press CTRL + X
  • Select "Cut" from the Edit menu in your browser
  • Right click to display the context menu and select the "Cut" command

Example 1: Using HTML 

Output: 

👁 Image
 

Example 2: Using JavaScript

Output: 

👁 Image

Example 3: In JavaScript, using the addEventListener() method: 

Output:

👁 Image

Supported Browsers: The browsers supported by HTML DOM oncut Event are listed below: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera
Comment
Article Tags: