How to reset timeout in Javascript/jQuery?

前端 未结 2 421
陌清茗
陌清茗 2020-12-16 13:41

I\'ve got a field A in my webpage which, when edited by the user, invokes an API call (using jQuery), which updates field B. After the edit, the API should be called every 1

2条回答
  •  执念已碎
    2020-12-16 14:20

    var update;
    
    // something happened
    
    clearTimeout(update);
    update = setTimeout(thisFunction, 10000);
    

提交回复
热议问题