HTMLElement.contextMenu

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The HTMLElement.contextMenu property refers to the context menu assigned to an element using the contextmenu attribute.

Syntax

JavaScript
var <var>elementContextMenu</var> = <var>element</var>.contextMenu;

Example

JavaScript
var contextMenu = document.getElementById("element").contextMenu; 

// Change the label of the first menu entry
contextMenu.firstElementChild.label = "New label";

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'HTMLElement.contextMenu' in that specification.
Living Standard No change
HTML5.1
The definition of 'HTMLElement.contextMenu' in that specification.
Working Draft Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support[1] ? (Yes) No support No support[1] ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ? ?

[1] An experimental implementation is available via the command line option --enable-blink-features=ContextMenu. Until Chrome 52 and Opera 39 it was additionally available by enabling the Experimental Web Platform features option, but got removed from that due to a Web compatibility issue. Support for this feature is requested in Chromium bug 87553.

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/htmlelement/contextmenu

API HTML DOM HTMLElement Property Reference