html contextmenu attribute
The contextmenu attribute on the html element:
- → allows you to access a context menu when right-clicking the element to which it is attached
- is a global attribute → can be applied on all html elements;
- when applied on the root element <html>, its value is inherited by all other html elements
Examples
<html | attribute | = | "value(s)" | > | ... | <⁄html> | example |
---|---|---|---|---|---|---|---|
4. | contextmenu | = | menu id value | <contextmenu="cmenu"> ... <⁄ > "menu_id_value" = this value is unique on page; must be found attached to a <menu> tag, as value of the 'id' attribute |
Video demonstration html contextmenu attribute
HTML5 html contextmenu attribute Tutorial
min | video details |
---|---|
00:02 | launch file contextmenu.php in browser |
00:05 | open file contextmenu.php in Notepad++ |
00:12 | contextmenu attribute's value: the value of the id attribute attached to HTML menu tag |
00:15 | contextmenu attribute, value: menu_id, applied on html starting tag |
00:35 | saving the modifications in Notepad++ and refreshing the file in browser |
00:38 | testing: <html contextmenu="menu_id"> |
00:39 | result: 2 defined commands are available in a content menu: "add border" and "remove border" |
00:59 | explanations: how the contextmenu has been created .. |
Note: contextmenu attribute is not yet supported in browsers |