4 ms·
JS is ok, it’s the DOM APIs that are verbose. I mean this is just to handle the enter key: f.addEventListener('keypress',e=>{if(e.keyCode==000) etc()})
by bamboleo 6y ago
JS is ok, it’s the DOM APIs that are verbose. I mean this is just to handle the enter key:
f.addEventListener('keypress',e=>{if(e.keyCode==000) etc()})
- rukshn 6y agoExactly these were the challenges I faced when using plain js
- tdeck 6y agoJust a fun note: You can replace this f.addEventListener('keypress',e=>{...}) With the older but essentially equivalent f.onkeypress=e=>{...} and save 18 characters. You can even use `onkeyup` and save 3 more characters.