how to alert when the time has ended in jquery?
<p>how to show alert when the time has ended and the timer should stop running i have tried the following code the but timer keeps on running and it does not show any alert messsge help me </p>

<pre><code>      &lt;script&gt;
 function startTimer(duration, display) {
    var timer = duration, minutes, seconds;
    setInterval(function () {
        minutes = parseInt(timer / 60, 10)
        seconds = parseInt(timer % 60, 10);

        minutes = minutes &lt; 10 ? "0" + minutes : minutes;
        seconds = seconds &lt; 10 ? "0" + seconds : seconds;

        display.text(minutes + ":" + seconds);

        if (--timer &lt; 0) {
            timer = duration;
        }
    }, 1000);
}

jQuery(function ($) {
    var fiveMinutes = 60 *0.10,
        display = $('#time');
    startTimer(fiveMinutes, display);
if(startTimer&lt;0)
{
    alert("time has ended");
}

});
  &lt;/script&gt;
&lt;div style="float-left"&gt;Test Will Ends in &lt;span id="time"&gt;10:00&lt;/span&gt; 
</code></pre>