Horje

How to execute a JavaScript when cutting some text of a <p> element (Note that contenteditable is set to "true")

The code is to try to cut this tex.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<p contenteditable="true" oncut="myFunction()">Try to cut this text</p>

<script>
function myFunction() {
  alert("You cut text!");
}
</script>

</body>
</html>

Output should be:

How to execute a JavaScript when cutting some text of a <p> element (Note that contenteditable is set to "true")




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Clipboard Events Attribute
Uploaded by:
Admin