samedi 23 juillet 2016

Timer for button clicks

We are preparing a "game" button with class function that you click as often as possible to generate (at this time) an increasing random number. However, we want it to stop functioning after a set time period, 10 seconds.

The click code below is for the number generation, but not sure how to create the timer to stop the button, and for testing purposes, display an alert.

$('.click-button').click(function()
{$('.score').html(function(i, val)
{return val - Math.floor(Math.random()* -11);});
});

Aucun commentaire:

Enregistrer un commentaire