Skip to content
Related Articles

Related Articles

Improve Article

HTML | <menuitem> tag

  • Last Updated : 04 Feb, 2021

The HTML <menuitem> tag is used to define command or menu that the user can utilize from the popup item. this tag is not supported in HTML5. This tag is support Global Attributes in HTML and Event Attributes in HTML.

Syntax:  

<menuitem label="" icon="" type> </menuitem>

Attribute:  

  • checked: this attribute defines that the menu item is checked when the page load, works on radio and checkbox type.
  • default: This attribute marks the menu item as a default command.
  • disabled: This attribute disabled the menu or command.
  • icon: This attribute define the menu icon by using url.
  • label: This attribute is must required which defines the name of command or menu.
  • radiogroup: This attribute defines the group of command.
  • type: This attribute defines the type of command or menu is it radio, checkbox or anything else.

Below example illustrate the HTML <menuitem> tag: 

Example:  



HTML




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

Output: 
Before: 
 

After: 
 

Supported Browsers: The browsers supported by <menuitem> tag are listed below: 

  • Mozilla Firefox

 

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :