The contextmenu
attribute installs
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.
The contextmenu
attribute is new in HTML5.
<element contextmenu="menu_id">
contextmenu |
No | No | Yes | No | No |
<!DOCTYPE html>
<html>
<head>
<style>
div {<!-- w ww .j a va2 s .co m-->
background: yellow;
border: 1px solid #cccccc;
padding: 10px;
}
</style>
</head>
<body>
<div contextmenu="mymenu">
<p>Right-click inside this box to see the context menu!</p>
<menu type="context" id="mymenu">
<menuitem label="Refresh from custom menu" onclick="" icon=""></menuitem>
</menu>
</div>
</body>
</html>