JavaScript: Check if CTRL button was pressed

Try looking in the event object.

e.g.

document.body.onclick = function (e) {
   if (e.ctrlKey) {
      alert("ctr key was pressed during the click");
   }
}
<p>Click me, and sometimes hold CTRL down!</p>

Leave a Comment