document.getElementById('code').addEventListener('keydown', handleKeydownEvent); document.getElementById('code').focus(); function handleKeydownEvent(e) { switch(e.key) { case 'SoftLeft': eval(document.getElementById('code').value); break; } }