Learn html - html tutorial - Oncontextmenu attribute in html - html examples - html programs
- The oncontextmenu attribute specifies through the user right-clicks on an element to open the context menu.
- The oncontextmenu attribute is section of the Event Attributes.
Syntax for oncontextmenu attribute in HTML:
Differences between HTML 4.01 and HTML5 for oncontextmenu attribute:
HTML 4.01
- HTML4 does not support oncontextmenu attribute.
HTML 5
- HTML5 support oncontextmenu attribute.
Applies To:
Element |
Attribute |
All HTML Elements |
oncontextmenu |
Attribute Values:
Value |
Description |
script |
The script can run on oncontextmenu. |
Sample Coding for oncontextmenu Attribute in HTML:
Code Explanation for oncontextmenu Attribute in HTML:
- oncontextmenu attribute is used to call the onContextMenu() function when the user Right-click the <div> element content.
- JavaScript function onContextMenu() is used to display an alert message.
Output for oncontextmenu Attribute in HTML:
- The div content was displayed, when the page has been loaded.
- When user right click over div element, the alert box has been displayed.
- After clicking the OK button in alert box, the context menu has been displayed.
Browser Support for oncontextmenu Attribute in HTML:
Related Searches to oncontextmenu Attribute in html
oncontextmenu javascript
oncontextmenu javascript example
contextmenu jquery
oncontextmenu react
html context
oncontextmenu return false
html5 context menu chrome
css context menu
html attributes
html tutorialshtml editor html code html form html tutorial html color html color codes html table html img html5 html code for website html and css html programs html website free html editor html5 tutorial wysiwyg html editor html tutorial pdf html converter php tutorial html example html tutorial css tutorial html css html tags html basics code html html online html mailto html lang html tags list