HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Execute a JavaScript when cutting some text in an <input> element
The oncut event occurs when the user cuts the content of an element.
Event | |||||
---|---|---|---|---|---|
oncut | Yes | Yes | Yes | Yes | Yes |
In HTML:
<element oncut="myScript">
In JavaScript:
object.oncut = function(){myScript};
In JavaScript, using the addEventListener() method:
object.addEventListener("cut", myScript);
Bubbles: | Yes |
---|---|
Cancelable: | Yes |
Event type: | ClipboardEvent |
Supported HTML tags: | All HTML elements |
Execute a JavaScript when cutting some text of a <p> element (Note that contenteditable is set to "true"):
<p contenteditable="true" oncut="myFunction()">Try to cut this text</p>
HTML DOM reference: oncopy event
HTML DOM reference: onpaste event