How to run a function once when binding to multiple events that all trigger in Javascript?

前端 未结 5 1088
失恋的感觉
失恋的感觉 2020-12-19 20:23

I have a search input that listens to keyup and change to trigger an update of a listview via Ajax.

Looks like this:

input.on         


        
5条回答
  •  感情败类
    2020-12-19 20:35

    Any reason for listening to keyUp in addition to change? Maybe what really matters is just one of these events.

    If not, I guess you will have to use a closure as you suggested.

提交回复
热议问题