keypress 이벤트가 발생할때 어떤키가 눌리는지 알기 위해 디버그 창을 이용해 확인했다.
그 후 코드 작성.
text.addEventListener('keypress', (event)=> { if(event.key === 'Enter'){ onAdd(); } })