YouTip LogoYouTip

Event Oncontextmenu

# oncontextmenu Event [![Image 3: Event Object Reference Manual](#) Event Object](#) ## Example Execute JavaScript when the user right-clicks on a
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 | [![Image 4: Event Object Reference Manual](#) Event Object](#)
← Php Closure CallC Command Line Arguments β†’

YouTip © 2024-2026 | Home | Learn Technology, Build Dreams!

All content is for educational and learning purposes only.