addEventListener("cut", myFunction); - Javascript DOM Event

Javascript examples for DOM Event:addEventListener

Description

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

Summary

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="text" id="myInput" value="Try to cut this text">

<script>
document.getElementById("myInput").addEventListener("cut", myFunction);

function myFunction() {/*from   w ww.  j a v  a 2 s.c om*/
    console.log("You cut text!");
}
</script>

</body>
</html>

Related Tutorials