Javascript DOM oncut Event via HTML Tag oncut function

Introduction

In JavaScript:

object.oncut = function(){myScript};

This example uses the HTML DOM to assign an "oncut" event to an input element.

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="text" id="myInput" value="Try to cut this text">
<p id="demo"></p>
<script>
document.getElementById("myInput").oncut = function() {myFunction()};

function myFunction() {//from  ww  w.  j a v  a 2s  .  co m
  document.getElementById("demo").innerHTML = "You cut text!";
}
</script>

</body>
</html>
Bubbles: Yes
Cancelable: Yes
Event type: ClipboardEvent
Supported HTML tags: All HTML elements



PreviousNext

Related