[jQuery] Disable Events under certain condition temporary?

[jQuery] Disable Events under certain condition temporary?


Hello!
http://www.les-elites.org/index.php?article_id=126&clang=0
http://www.les-elites.org/index.php?article_id=126&clang=0
on this site u can test what i mean.
I want that when all skillpoints are used further click function is
disabled or better only works to disable selection to gain again a
skillpoint.
On current state u can see that when skill counter is at 0, 2 clicks
messes up the selection and u can select further on.
my code for each icon looks so far like this:
$("#2").toggle(
function () {
    if (counter > 0) {
    $("#3").attr("disabled", false).fadeTo("fast", 0.50);
        $("#2").val("dump_guns").fadeTo("slow", 1.00);
        $("#1").attr("disabled", true);
        counter --;
        $("#counter").text(counter);
        }
},
function () {
if (counter >= 0) {
    $("#3").attr("disabled", true).fadeTo("slow", 0.10);
        $("#2").val("").fadeTo("slow", 0.50);
        $("#1").attr("disabled", false);
        counter++;
        $("#counter").text(counter);
        }
}
);
hope anyone can give me a hint how to solve this!
thx in advance
--
View this message in context: http://www.nabble.com/Disable-Events-under-certain-condition-temporary--tp23703870s27240p23703870.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.