# Action after user stops typing

**URL:** <https://forum.kirupa.com/t/action-after-user-stops-typing/95152>\
**Category:** Uncategorized\
**Created:** [November 21, 2003, 5:55am UTC](https://forum.kirupa.com/t/action-after-user-stops-typing/95152 "2003-11-21T05:55:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digigamer](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digigamer/32/276_2.png) [@Digigamer](https://forum.kirupa.com/u/Digigamer)\
**Post date:** [November 21, 2003, 5:55am UTC](https://forum.kirupa.com/t/action-after-user-stops-typing/95152/1 "2003-11-21T05:55:21Z")

</div>

hey I am trying to write this code where it watches a user typing in a text box and then once the user has finished typing it does a certain action. I was thinking maybe run a timer after every keypress and if the user does not press a key within 2 seconds of the last one it exicutes the action. If any of you have a more efficient way of doing this please post it. Anyways what I have so far is

[AS]this.onKeyDown = function() {  
function doneDelay(){  
loadVariablesNum(“write.php”, 0, “POST”);  
clearInterval(delay);  
}  
delay = setInterval(doneDelay, 2000);  
}  
Key.addListener(this);  
[/AS]

this works somewhat but it exciutes continuouly after the user stops typing ☹
