menuitem type Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:menuitem

Description

The type attribute specifies the type of command/menu item.

Attribute Values

ValueDescription
command Default. Specifies a normal command with an action
checkbox Specifies a command that can be toggled using a checkbox
radioSpecifies a command that can be toggled using a radio button

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div style="background:yellow;border:1px solid #cccccc;padding: 10px;" contextmenu="mymenu">
<p>Right-click inside this box to see the context menu!</p>

<menu type="context" id="mymenu">
  <menuitem disabled label="Refresh" onclick="window.location.reload();" icon="https://www.java2s.com/style/demo/Opera.png"></menuitem>
  <menu label="Main Menu">
    <menuitem type='checkbox' label="Sub 1" icon="https://www.java2s.com/style/demo/Firefox.png" onclick="window.open('http://java2s.com/' + window.location.href);"></menuitem>
    <menuitem type='checkbox' label="Sub 2" icon="https://www.java2s.com/style/demo/Google-Chrome.png" onclick="window.open('http://java2s.com/' + window.location.href);"></menuitem>
  </menu><!--from  ww w  .  jav a  2 s .co  m-->
  <menuitem type="checkbox" default="default" checked="checked" label="Item" onclick=""></menuitem>
</menu>

</div>

</body>
</html>

Related Tutorials