event.key

CashCash·2021년 1월 20일
0

javascript

목록 보기
10/12

keypress 이벤트가 발생할때 어떤키가 눌리는지 알기 위해 디버그 창을 이용해 확인했다.

그 후 코드 작성.

text.addEventListener('keypress', (event)=> {
  if(event.key === 'Enter'){
    onAdd();
  }
})
profile
studying frontend

0개의 댓글