1

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?

5
  • write count = 4 before the posted code and make sure it reaches this line...
    – Michal B.
    Commented Feb 27, 2012 at 8:36
  • 4
    Maybe its not running, because count is never 4 ^^ Commented Feb 27, 2012 at 8:36
  • Could you elaborate on where the variable count comes from?
    – Legolas
    Commented Feb 27, 2012 at 8:37
  • In another words - show us where and how you set count value Commented Feb 27, 2012 at 8:37
  • Check the error console first. If there are no errors, try to create a jsFiddle that reproduces your problem. We certainly need to see more of your code.
    – kapa
    Commented Feb 27, 2012 at 8:37

2 Answers 2

5

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.

0
1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.