document.addEventListener('keydown', event => {
console.log(event.key); // logs the key
if (event.key == " ") {
// Your code, when space is pressed
} else if (event.key == "a") {
// Your code, when small a is pressed
}
})
// | | | |
// V V V V If you don't know the keys use the source below
Code Example |
---|
Javascript :: window.print specific div |
:: |
Javascript :: |
:: get nearest to user location js |
:: find invalid json files in directory |
Javascript :: cpprestsdk json |
Javascript :: nodejs Websocket chat room |
:: how to merge data rn |
Javascript :: |
:: router unique validation for mongoose |
Javascript :: jquery switch css style sheets |
:: keep records of number rolled in array javascript |
Javascript :: |
:: |
Javascript :: javascriot html eqaul to jquery |
:: how to add a key to every html tag in a list react |
:: |
Javascript :: |
Javascript :: reverse not working react |
:: |
:: Pass Props to a Component Using Short circuit evaluation in react |
:: js hide modal event listener name |
Javascript :: javascript responsive carousel |
Javascript :: |
:: filter array and get index of num |
:: |
Javascript :: |
:: trigger keyup event jquery |
Javascript :: on change swich |
:: |