English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery event.metaKey Attribute

jQuery Events

The event.metaKey property checks if the META key is pressed when the event is triggered.

If the META key is pressed when the event is triggered, this method returns true, otherwise it returns false.

In some platforms, this key may be mapped to an alternative key name:

  • On the Macintosh keyboard, the META key is mapped toCommand key()

  • On the Windows keyboard, the META key is mapped toWindows key(Win key)

Syntax:

event.metaKey

Example

Determine if the META key is pressed when the event is triggered:

$("button").click(function(event) {
  $("#output").text(event.metaKey);
});
Test and see‹/›

Parameter Value

ParameterDescription
eventTheEventThe parameters come from the event binding feature

jQuery Events