document.addEventListener('keypress', (event) => { if(event.key && event.key != 'Enter'){ console.log('this is a character') } });