HTML oncontextmenu Attribute
Example
<div oncontextmenu="myFunction()" contextmenu="mymenu">
Meaning
The oncontextmenu attribute is called when a context menu is invoked generally by right-click. Can be fired by direct targeting of the element or the event bubbling up.
Standard Syntax
<element oncontextmenu="script">
Applies to:
The oncontextmenu attribute can be used on the following element:
| Element | Attribute |
|---|---|
| All HTML elements | oncontextmenu |
Advertisement
Attribute Values
| Value | Description |
|---|---|
| script | Specifies the script to be run on oncontextmenu |