0
How use keyUp , keyDown and keyPress in JS?
if you can please add example. Thanks!
3 ответов
+ 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>
+ 1
you need it to click the button with the ID
0
Rhythm Khandelwal how can i specify the key?