one way to do this would be with a timeout, although a bit different than you explained it.. start a timeout onkeyup, and clear it onkeydown, so after stopping typing the timeout won't be cleared and 5 seconds later the function will run..
dennis. [EMAIL PROTECTED] wrote:
Confusing title, but what I'm looking for can't really be summed up in a sentence [ bonus points if you can ]. Basically I have a onkeyup binded to a <textarea>, and the function the onkeyup calls sends the data to the server to be saved. I'm wondering if a method to only send the data when you stop typing exists. So basically you can be typing a paragraph quickly, and it *won't* call the function, but once you stop typing [say 5 seconds after the last key up], the function is called. What I think would be the best [and possibly only] way to achieve this, is to check the last time the function was called, and do a setTimeout() for 5 seconds, and when this check function is called again, it clears the timeout and starts it again. Is there any other way?