HTML Menu Tag:
HTML5 introduced a `<menu>` element that is used to define a group of commands that a user can invoke. The `<menu>` element is typically used in conjunction with JavaScript to create context menus or toolbars.
HTML menu Tag |
Here's a basic example:
html
<menu type="context" id="myContextMenu">
<menuitem label="Copy" onclick="copyFunction()"></menuitem>
<menuitem label="Paste" onclick="pasteFunction()"></menuitem>
</menu>
<script>
function copyFunction() {
alert("Copy function invoked");
}
function pasteFunction() {
alert("Paste function invoked");
}
</script>
In this example, a context menu is created using the `<menu>` element, and two menu items (`<menuitem>`) are defined with labels and associated JavaScript functions.
Keep in mind that browser support for the `<menu>` element may vary, and it's often used in combination with CSS and JavaScript to create interactive menus. Always check for the latest HTML specifications and browser compatibility information.