More "Try it Yourself" examples below.
Definition and Usage
The oncopy event occurs when the user copies the content of an element.
Tip: The oncopy event also occurs when the user copies an element, for example, an image, created with the <img> element.
Tip: The oncopy event is mostly used on <input> elements with type="text".
Tip: There are three ways to copy an element/the content of an element:
- Press CTRL + C
- Select "Copy" from the Edit menu in your browser
- Right click to display the context menu and select the "Copy" command.
Note: The oncopy event may not work as expected in some browsers when trying to copy an image (See "More Examples" below).
Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.
|Supported HTML tags:||All HTML elements|
HTML DOM reference: onpaste event
HTML DOM reference: oncut event