I want to display an alert () window, just 10 seconds after the user stops writing text in the text box.
I used the following javscript code to open an alert window -
function txtkeyup(e){ setTimeout(function () { alert('submit?'); }, 10000); return true; }
and the HTML code is
<input type='textbox' name='searchquery' value='' onkeyup='return txtkeyup();'>
Now the browser tells alertbox 10 seconds after each onkeyup event in the input field. To make only one request, I must reset the setTimeout () timer in each keyup event so that a warning is displayed if the user does not press the button for 10 seconds.
How to reset the timer of the previously named 'setTimeout ()' in javscript? Please help me..
Vin
source share