Horje

How to Execute a JavaScript when pasting some text in a <p> element (Note that contenteditable is set to "true") - HTML onpaste Attribute

P Example. Try to paste something inside this paragraph.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<p contenteditable="true" onpaste="myFunction()">Try to paste something inside this paragraph.</p>

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

</body>
</html>

Output should be:

How to Execute a JavaScript when pasting some text in a <p> element (Note that contenteditable is set to "true") - HTML onpaste Attribute




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