HTMLElement.contextMenu

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The HTMLElement.contextMenu property refers to the context menu assigned to an element using the contextmenu attribute. The menu itself is created using the <menu> element.

Syntax

var elementContextMenu = element.contextMenu;

Example

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

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

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLElement.contextMenu' in that specification.
Living Standard No change
HTML 5.1
The definition of 'HTMLElement.contextMenu' in that specification.
Recommendation Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support ? Yes1 ? ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes Yes4 ? ? ?

See also

Document Tags and Contributors

Contributors to this page: fscholz, valtlai, Sheppy, Sebastianz
Last updated by: fscholz,