View video tutorial

HTML oncopy Attribute

HTML

The HTML oncopy attribute is an event handler that triggers a script to execute when the user copies the contents of an element.

Definition and Usage


➔ The oncopy attribute can be applied to various HTML elements, including input fields, textareas, divs, img tags, and more.

➔ A copy action can be performed in various ways such as by pressing Ctrl+C, selecting "Copy" from the context menu, or selecting "Copy" from the browser's Edit menu.

➔ oncopy is triggered when the user copies the content of the element.

Applies to

This attribute can be used on the following element.

Attribute Element
oncopy All visible elements