event.metaKey
Indicates whether the META key was pressed when the event fired.
.event.metaKey()🡢 Boolean
Returns a boolean value (true
or false
) that indicates whether or not the META key was pressed at the time the event fired. This key might map to an alternative key name on some platforms.
On Macintosh keyboards, the META key maps to the Command key (⌘).
On Windows keyboards, the META key maps to the Windows key.
Determine whether the META key was pressed when the event fired.
JS
<button value="Test" name="Test" id="checkMetaKey">Click me!</button>
<div id="display"></div>
CSS
body {
background-color: #eef;
}
div {
padding: 20px;
}
HTML
$("#checkMetaKey").click(function (event) {
$("#display").text(event.metaKey);
});
DEMO