English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The contextmenu global attribute refers to the ID attribute of the <menu> used for the "context menu" of an element. A context menu is a menu that appears during user interaction (such as right-clicking). HTML5It allows us to customize this menu. Here are some implementation examples, including nested menus.
The contextmenu attribute is deprecated and will be removed from all browsers.
Specify a context menu for the <div> element. When the user right-clicks on the element, the context menu will be displayed:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML contextmenu 属性的使用(基础教程网 oldtoolbag.com)</title> </head> <body contextmenu="share"> <menu type="context" id="share">Test to see ‹/›
IEFirefoxOperaChromeSafari
Currently, only the Firefox browser supports the contextmenu attribute.
The contextmenu attribute specifies the context menu of an element. When the user right-clicks on the element, the context menu will be displayed.
The value of the contextmenu attribute is the ID of the <menu> element to be opened.
The contextmenu attribute is an HTML5 new attribute in the middle of.
<element contextmenu="menu_id">
Value | Description |
---|---|
menu_id | The id of the <menu> element to be opened. |