HTML onshow Event Attribute

Description

The event attribute onshow occurs when the <menu> element is displayed as a context menu.

Syntax

<element onshow="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE html > 
<html> 
  <head> 
    <title>onshow event</title>  
  </head> 
  <body>  
  <div contextmenu="mymenu"> 
  <p>Right click here to see the context menu.!</p> 
  <menu type="context" id="mymenu" onshow="test()"> 
  <menuitem label="Refresh" onclick="window.location.reload();"></menuitem> 
  </menu>
  </div>
<script>
function test() {
  alert("The context menu will be shown!");
}
</script>
  </body> 
</html>

Supported Tags

<menu>

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
XXXYesXX
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
XXYesXXX