this is my code in JavaScript:
var changeIdValue = function(id, value) {
document.getElementById(id).style.height = value;
};
document.getElementById (\"ba
The 2019 version of this would be: (works in all major browsers - Chrome, Firefox, Safari)
Spec link - https://www.w3.org/TR/uievents/#dom-keyboardevent-code
code holds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value. The un-initialized value of this attribute MUST be "" (the empty string).
// event = keyup or keydown
document.addEventListener('keyup', event => {
if (event.code === 'Space') {
console.log('Space pressed')
}
})