English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The contextmenu() method triggers the contextmenu event, or attaches a function to be executed when the contextmenu event occurs.
The contextmenu event occurs when the user right-clicks on an element to open the right-click menu.
Trigger the contextmenu event of the selected element:
$.contextmenu()
Attach a function to the contextmenu event:
$.contextmenu(function
Change the font size of the paragraph on the page when right-clicked:
$("p").contextmenu(function(){ $(this).css("font-size", "3em"); });Test and see‹/›
Hide the paragraph on the page when right-clicked:
$("p").contextmenu(function(){ $(this).slideUp(); });Test and see‹/›
Parameters | Description |
---|---|
function | Function executed when the contextmenu event is triggered |