+ 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

24th Mar 2022, 8:25 AM
vivek rai
vivek rai - avatar
7 ответов
+ 2
Write your function like this function keyPress(){ document.querySelector('#keys').innerHTML = `You pressed ${event.key} and it's code is ${event.code}`; }
24th Mar 2022, 10:06 AM
Mahmoud Al Hussain
Mahmoud Al Hussain - avatar
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.
24th Mar 2022, 8:55 AM
vivek rai
vivek rai - avatar
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.
24th Mar 2022, 9:06 AM
vivek rai
vivek rai - avatar
0
Not working. Can you share your code
24th Mar 2022, 10:28 AM
vivek rai
vivek rai - avatar