0

How use keyUp , keyDown and keyPress in JS?

if you can please add example. Thanks!

27th Apr 2018, 8:54 AM
Imamura Munemitsu
Imamura Munemitsu - avatar
3 odpowiedzi
+ 3
In given example, when you press any key on keyboard in input field, the background color of body will change to red. <input type="text" onkeydown="myFunction()"> <script> function myFunction() { document.body.style.backgroundColor = "red"; } </script>
27th Apr 2018, 9:20 AM
Rhythm Khandelwal
+ 1
you need it to click the button with the ID
30th Mar 2021, 12:51 PM
MrAvtoritet
MrAvtoritet - avatar
0
Rhythm Khandelwal how can i specify the key?
22nd Jan 2019, 7:04 AM
Maneren
Maneren - avatar