This question already has an answer here:
- How to delay the .keyup() handler until the user stops typing? 25 answers
I want to make a javascript function that fires onkeyup event and its task is to call a main resolver function but only if no keys are fired for at least x miliseconds where x is the functions parameter.
For instance:
we have html code
<body>
<input type="text" id="suggestion" onkeyup="callMe(200);"/>
</body>
and javascript something like:
<script type="text/javascript">
function callMe(ms)
{
//wait at least x ms then call main logic function
// e.g. doMain();
alert("I've been called after timeout"); //for testing purposes
}
</script>
So while i'm typing the alert won't be called until you don't type anything for at least x ms.