element:
[Try it Β»](#)
* * *
## Definition and Usage
The oncontextmenu event is triggered when the user right-clicks on an element to open the context menu.
**Note:** All browsers support the oncontextmenu event. The (#) element is only supported by the Firefox browser.
* * *
## Browser Support
| Event | | | | | |
| --- | --- | --- | --- | --- | --- |
| oncontextmenu | Yes | Yes | Yes | Yes | Yes |
* * *
## Syntax
In HTML:
(#)
In JavaScript:
_object_.oncontextmenu=function(){_myScript_};(#)
In JavaScript, using the addEventListener() method:
_object_.addEventListener("contextmenu", _myScript_);(#)
**Note:** Internet Explorer 8 and earlier versions of IE do not support [addEventListener()](#).
* * *
## Technical Details
| Bubbles: | Yes |
| --- |
| Cancelable: | Yes |
| Event Type: | MouseEvent |
| Supported HTML Tags: | All HTML elements |
[ Event Object](#)
YouTip