subhojit777
subhojit777

Reputation: 596

if block in javascript not running

This if block:

count = 1;
if (count == 4) {
            alert(count);
            $(":checkbox").attr("disabled", true);
            count = 0;
        }

is not running. I have also added an alert() but its not appearing. My javascript code also contains some jQuery. How to solve it?

Upvotes: 1

Views: 110

Answers (2)

David Hedlund
David Hedlund

Reputation: 129802

In your current code, you're always setting count to 1 before checking whether it is 4. It will never be 4, it will always be 1.

Upvotes: 5

Chuck
Chuck

Reputation: 237080

Based on this information, it would appear that count is not 4. If you want this block to run anyway, get rid of the whole if(){} around it.

Upvotes: 1

Related Questions