Horje

How to Execute a JavaScript when copying some text of an <input> element

Input Example.
index.html
Example: HTML
<input type="text" oncopy="myFunction()" value="Try to copy this text">

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "You copied text!"
}
</script>

Output should be:

How to Execute a JavaScript when copying some text of an <input> element




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