HTML contextmenu Attribute

You are Here:

HTML contextmenu Attribute

The contextmenu attribute defines a context menu for an element.

The context menu appears when a user right-clicks on the element.

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

Warning: The contextmenu attribute is deprecated and is no longer recommended.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <div contextmenu="popup-menu"> <menu type="context" id="popup-menu"> <menuitem type="checkbox" icon="/image/checked.png" checked>Checkbox</menuitem> <menuitem type="checkbox" icon="/image/copy.png">Copy</menuitem> </menu> </div> </body> </html>

Attribute Value

ValueExplanation
IDSpecifies the id of a <menu> to use as the contextual menu for this element.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author