Chron
1 month ago

How to get keycode in an input event

Posted 1 month ago by Chron

Here is the code:

let el = document.querySelector("input[name='test']")

el.addEventListener('input', (e)=>{
 console.log(e.keyCode)
})

But e only points the actual element. Is there a way to get the key code as well?

Please sign in or create an account to participate in this conversation.