MDN self-hosted library · e01.org

TouchEvent: altKey property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
someElement.addEventListener("touchstart", (e) => {
  // Log the state of this event's modifier keys
  console.log(`altKey = ${e.altKey}`);
  console.log(`ctrlKey = ${e.ctrlKey}`);
  console.log(`metaKey = ${e.metaKey}`);
  console.log(`shiftKey = ${e.shiftKey}`);
});