HTMLElement.contextMenu

Deprecated
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

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";

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
DeprecatedNon-standard
Chrome ? Edge Full support YesFirefox Full support 1IE ? Opera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.

See also

Document Tags and Contributors

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