Execute a JavaScript when copying some text of a <p> element:
<!DOCTYPE html> <html> <body> <p oncopy="myFunction()">Try to copy this text</p> <p id="demo"></p> <script> function myFunction() {/*ww w .jav a 2 s . c o m*/ document.getElementById("demo").innerHTML = "You copied text!"; } </script> </body> </html>