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.


var elementContextMenu = element.contextMenu;


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

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


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

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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

Document Tags and Contributors

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