keyboard shortcuts javascript code example
Example: js shortcut
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && String.fromCharCode(e.keyCode).toLowerCase() === 's') {
e.preventDefault();
e.stopPropagation();
// Do some stuff...
}
}, false);