Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can someone explain what the contextmenu attribute in HTML5 does?

Tags:

html

can someone explain what the the contextmenu attribute does and if it can be used with all the HTML elements and can someone point me to some online demos/examples?

like image 679
HELP Avatar asked Nov 07 '10 18:11

HELP


People also ask

What is Contextmenu in HTML?

A context menu is a menu that appears upon user interaction, such as a right-click. HTML5 now allows us to customize this menu. Here are some implementation examples, including nested menus.

How do I use Contextmenu?

The toolbar appears when the user selects a range of text. A context menu appears. This type of on-object user interface appears near the selected object, usually after the user right-clicks a selection. The context menu pops up above or beside a selected object and displays a list of commands that fit the selection.

What is Contextmenu in Javascript?

A context menu is a menu in a GUI that appears upon user interaction, such as a right-click mouse operation. A context menu offers a limited set of choices that are available in the current state, or context, of the operating system or application.

How do I create a right-click menu in HTML?

To make this HTML menu visible when right-clicking in the browser, we need to listen for contextmenu events. We can bind the event listener directly on the document or we can limit the area that a user can right-click to see the custom context menu. In our example, the area for right-click is the entire body element.


1 Answers

The contextmenu attribute refers to the <menu> element the user agent should render when a context menu is requested by the user (e.g. using the right mouse button or the Menu/Hyper key on modern keyboards.

You can find an example here.

like image 133
Frédéric Hamidi Avatar answered Nov 15 '22 07:11

Frédéric Hamidi