oncopy event
Examples
JavaScript is executed when the <input> element to copy text:
try it"
The bottom of the article contains more examples.
Definition and Usage
oncopy event is triggered when users copy content element.
Tip: oncopy event will be triggered when the user copy elements, such as a copy of <img> element.
Tip: oncopy event is often used type = "text" of the <input> elements.
Tip: There are three ways you can copy elements and content:
- Press CTRL + C
- (Edit) menu, select "Copy (Copy)" in your browser's Edit
- Mail mouse button and select "Copy (copy)" command in the context menu.
Browser Support
event | |||||
---|---|---|---|---|---|
oncopy | Yes | Yes | Yes | Yes | Yes |
Note: When you try to copy a picture (see more instances), oncopy events may not be applied in Chrome, Firefox and Opera browsers.
grammar
In HTML:
In JavaScript:
JavaScript, use the addEventListener () method:
Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.
technical details
Whether to support the bubble: | Yes |
---|---|
It can be canceled: | Yes |
Event Type: | ClipboardEvent |
Supported HTML tags: | All HTML elements |
More examples
Examples
JavaScript is executed in the copy <p> elements in the text:
try it"
Examples
Executed copy pictures JavaScript:
try it"
Related Pages
HTML DOM Reference: onpaste event
HTML DOM Reference: oncut event
Event objects