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

Looking for a Web Developer?

👋

Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)