HTML <menuitem> type Attribute
Last Updated :
31 Aug, 2022
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 =
</ 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: