Javascript examples for DOM Event:Element Event Attribute
The onpaste event occurs when the user pastes some content in an element.
Bubbles | Yes |
---|---|
Cancelable | Yes |
Event type: | ClipboardEvent |
Supported HTML tags: | All HTML elements |
<!DOCTYPE html> <html> <body> <input type="text" id="myInput" value="Try to paste something in here" size="40"> <script> document.getElementById("myInput").onpaste = function() {myFunction()}; function myFunction() {/*from w w w.ja va2s. c o m*/ console.log("You pasted text!"); } </script> </body> </html>