Javascript DOM oncut Event

Introduction

Execute a JavaScript when cutting some text in an <input> element:

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="text" oncut="myFunction()" value="Try to cut this text">
<p id="demo"></p>
<script>
function myFunction() {//w  w w  .j av a 2 s  .  com
  document.getElementById("demo").innerHTML = "You cut text!";
}
</script>
</body>
</html>

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

The oncut event is mostly used on <input> elements with type="text".

Bubbles: Yes
Cancelable: Yes
Event type: ClipboardEvent
Supported HTML tags: All HTML elements



PreviousNext

Related