Usually you want to avoid setting events in html. but if I had to guess, your code would look something like this:
<tag onkeydown="javascript:function_name()">
Having your actual code will help direct this a bit more, but this is the next step.
function function_name(event){ console.log(event.key)
This should print the key you pressed. for your own reference.
source share