How do I prevent the countdown timer from displaying negative values?

Responsive Ad Header

Question

Grade: Education Subject: Support
How do I prevent the countdown timer from displaying negative values?
Asked by:
69 Viewed 69 Answers

Answer (69)

Best Answer
(231)
In your JavaScript function, before updating the button's text, check if the `remainingTime` is less than zero. If it is, set `remainingTime` to zero. You can also display a message like 'Time Expired' instead of a negative value.