I want to detect when the Alt/Option key and any other key are both pressed down simultaneously in a textarea on Mac. For example, I want to check for Alt/Option + 'h':
HTML
<textarea onkeydown="myFunction(event);"></textarea>
JavaScript
function myFunction(e) {
if (e.altKey && e.key=="h") {
// Do something here
}
}
The function works if I use Control instead of Alt. How can I get this to work with Alt on Mac?