+ 1
Why event.key is not working
Why event.key is not working. I was watching a tutorial and there was exact same code and his code worked. Please tell me what's wrong with this code. https://code.sololearn.com/WV8Aw4QlM9n0/?ref=app
7 Answers
+ 2
Write your function like this
function keyPress(){
document.querySelector('#keys').innerHTML = `You pressed ${event.key} and it's code is ${event.code}`;
}
0
I am not understanding your code because I am learning js now.
What I actually want in cod if I type any keyword in input field it should shows what I have typed.
0
I ran your code but when I press any keyword it shows unidentified was pressed. But I want it should shows what I have pressed.
0
Not working.
Can you share your code