How to trigger an onkeyup event that's delayed until a user pauses their typing?

后端 未结 7 755
生来不讨喜
生来不讨喜 2020-11-29 03:16

I have a textarea where people enter some text (naturally), and I want to make it so that an AJAX request is made every now and then to get some suggestions regarding what t

7条回答
  •  孤城傲影
    2020-11-29 04:12

    I would personally use a setInterval that would monitor the textarea for changes and only perform AJAX callbacks when it detects a change is made. every second should be fast and slow enough.

提交回复
热议问题