html catch event when user is typing into a text input

前端 未结 4 1493
梦毁少年i
梦毁少年i 2020-12-31 01:53

Im just wondering how I go about catching the event when the user is typing into a text input field on my web application.

Scenario is, I have a contacts listing gri

4条回答
  •  被撕碎了的回忆
    2020-12-31 02:24

    I would use the 'input' and 'propertychange' events. They fire on cut and paste via the mouse as well.

    Also, consider debouncing your event handler so that fast typists are not penalized by many DOM refreshes.

提交回复
热议问题