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 milliseconds 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.