We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
2023 / 09 / 22
TIL: Capture keydown events on DIV elements
2023 / 09 / 22
How to capture keydown/keypress events on HTML elements that aren't inputs
frontend
vue
Just set the tabindex
attribute, then you’ll be able to listen
to keydown
— or keyup
, keypress
— events like this:
<div tabindex="1" @keydown.esc="doSomething()">
I can emit keydown events now!
</div>