X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML contextmenu Attribute


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



Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook