setInterval onclick of #fr_tab div and clear on click of anywhere in document
<p>I have this jquery code: </p>

<pre><code>    $('#fr_tab').click(function() {
    $("#tab2").empty().html('&lt;img src="images/loading.gif" /&gt;');
var handle = setInterval(function () {
    $('#tab2').load('fr_quests.php');
    }, 3000);   
    });

    $('body').click(function() {
        if (handle) {
            clearInterval(handle);
            handle = 0;
        }
    });
</code></pre>

<p>I was wondering how I can setIneterval when #fr_tab is clicked and how I can clear it if anywhere in the document has been clicked.</p>
