Can you help me with my virtual keyboard? I need to add keydown event with changing background into orange color on each button. in HTML I use buttons with classes .letter and .symbol.
window.addEventListener('keydown', function(event) {
console.log('Event', event)
if(event.keyCode) {
myButton.style.backgroundColor = 'orange';
}
})
window.addEventListener('keyup', function(event){
myButton.style.backgroundColor = 'white'
})
Using a data attribute you can select the button based on the key pressed.