<button>Click me with the meta key</button>
<p id="output"></p>KeyboardEvent: metaKey property / notebook
KeyboardEvent: metaKey property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
document.querySelector("button").addEventListener("click", (e) => {
document.querySelector("#output").textContent =
`metaKey pressed? ${e.metaKey}`;
});