Why stop interval not work
<p>hey guys why my stop interval not work this is my try to stop interval but fail can someone help me pleas thank you?</p>

<p>HTML:</p>

<pre><code>&lt;strong id="gg"&gt;&lt;/strong&gt;
&lt;button onclick="StopInterval();"&gt;Stop Interval&lt;/button&gt;
</code></pre>

<p>JS:</p>

<pre><code>interval();
var interval = function()
{
      var t = 10;
      setInterval(function() {
        t--;
        if (t &gt;= 0) {
          $("#gg").html(t);
        }
        if (t === 0) {  
            clearInterval(t);
        }
      }, 1000);
}

function StopInterval() {
    clearInterval(interval);
}
</code></pre>