enabling and disabling clicks using jquery
<p>I have four buttons which has click able property. Clicking on button will make a div slide down and clicking again on same div should close the div. I want to add a condition like, when I have a div open, the click property on rest of the three buttons should be disabled, what I did is</p>

<pre><code>for (var i = 1; i &lt;= 4; i++) {
    $(".slide" + i).click(function () {
        var openTab = $(this).attr('class');
        openTab = openTab.replace('slide', '');
        var facetGroup = $(this).attr("key");
        if ($('#panel').is(':visible')) {
            buttonCloser(openTab);
        } else {
            buttonOpener(openTab, facetGroup);
        }
    });
}

function buttonCloser(m) {
    for (var j = 1; j &lt;= 4; j++) {
        if (j != m) {
            //alert(j);
            $(".slide" + j).bind("click");
        } else {
            $(".slide" + j).css({
                "background-color": " #fff5c3",
                "color": "#000000"
            });
        }
    }
    $("#panel").slideUp("slow");
}

function buttonOpener(m, n) {
    for (j = 1; j &lt;= 4; j++) {
        if (j != m) {
            $(".slide" + j).unbind("click");
        } else {
            $(".slide" + j).css({
                "background-color": "#293345",
                "color": "#fff5c3"
            });
        }
    }
    $("#panel").slideDown("slow");
    refreshFacet(n);
}
</code></pre>

<p>The problem with this code is that the first time I open a div by clicking on slider, the other three click events are disabled, bt when I close that div, it will nt re-enable its click property. so it wont open anything..</p>
