I'm trying to set a time limit of like 2 mins after time of a click event. How can I achieve this? Most of the countdown timers I see all over the internet are countdowns to dates like Aug 23, 2015

Recommended Answers

All 2 Replies

I havent had the need to do this myself, but if I were to go about developing this I beleive that I'd use an input type=hidden element on the page and when the click event happens, record the current time in that elements value. Then start running a function using setInterval and continue to run that function checking the current time against the time I stored in the input hiddent element. When the time difference is greater than 120 seconds, then peform some action and stop the timer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.