Here is the idea: if you use
setTimeout
, before the expiration time you can cancel it on the same timeout object using
clearTimeout
. Here is how:
http://www.w3schools.com/jsref/met_win_cleartimeout.asp[
^].
Apparently, when the timeout is wound up and before expiration your button's click handle should get visible, access that timeout object (named
myVar
in the code sample referenced above) and call
clearTimeout(myVar);
then it would be good to hide this button.
I hope you know how to handle button clicks and hide/show elements. If something of that is a problem, all you have to do is to ask in an appropriate way.
—SA