Open In App

HTML <menuitem> type Attribute

Last Updated : 31 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The type attribute in <menuitem> tag is used to define the type of commands of the menuitems.  

Syntax:

<menuitem type="command|checkbox|radio">

Attribute Values:

  • command: It has a Default value. It defines  a standard order with an action
  • checkbox: It defines a command that can be toggled using a checkbox
  • radio: It defines  a command that can be toggled using a radio button

Note: This attribute is depreciated from HTML 5.

Example: Below HTML code demonstrates the use of type attribute in <menuitem> element. 

HTML




<!DOCTYPE html>
<html>
 
<head></head>
 
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
 
        <h2>HTML <menuitem> type attribute</h2>
 
        <div style="background:green;
                    border:2px solid black;
                    padding: 10px;" contextmenu="geeks">
             
<p>A Computer Science Portal for Geeks</p>
 
            <menu type="context" id="menuID">
 
                <menu label="Share on...">
                    <menuitem label="Twitter"
                              type="command"
                              onclick=
"window.open('//twitter.com/intent/tweet?text='+ window.location.href);">
                    </menuitem>
                    <menuitem label="Pinterest"
                              type="command"
                              onclick=
"window.open('http://pinterest.com/pin/create/button/?url='+ window.location.href);">
                    </menuitem>
                </menu>
 
                <menuitem label="Email This Page"
                          type="command"
                          onclick=
"window.location='mailto:?body='+ window.location.href;">
                </menuitem>
            </menu>
        </div>
         
<p>A Computer Science Portal for Geeks</p>
 
        <hr>
         
<p>Right click on green div and see the menuitem
    </center>
</body>
 
</html>


Output:

HTML <menuitem> type Attribute” srcset=”https://media.geeksforgeeks.org/wp-content/uploads/20220126220955/62rppg.gif” sizes=”100vw” width=”500″><figcaption>HTML <menuitem> type Attribute</figcaption></figure>
<p><strong>Supported Browser:</strong></p>
<ul>
<li>Mozilla Firefox</li>
</ul>
<br/><div id=

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads