THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML contextmenu Attribute - Removed


Example

Specify a context menu for a <div> element. The context menu appears when a user right-clicks on the element:

<div contextmenu="mymenu">

<menu type="context" id="mymenu">
  <menuitem label="Refresh"></menuitem>
  <menuitem label="Twitter"></menuitem>
</menu>

</div>
Try it Yourself »

Definition and Usage

The contextmenu attribute specifies a context menu for an element. The context menu appears when a user right-clicks on the element.

The value of the contextmenu attribute is the id of the <menu> element to open.


Browser Support

Attribute
contextmenu Not supported Not supported Yes Not supported Not supported

Differences Between HTML 4.01 and HTML5

The contextmenu attribute is new in HTML5.


Syntax

<element contextmenu="menu_id">

Attribute Values

Value Description
menu_id The id of the <menu> element to open

Related Pages

HTML Tutorial: HTML Attributes