0

I would like to create an alert once too many check boxes have been checked.

Please see the setup here:

http://jsfiddle.net/wDbej/2/

At the moment - the alert keep returning 0 - rather than counting the checkboxes...

Any suggestions would be great thanks!

2 Answers 2

1

http://jsfiddle.net/wDbej/6/ - move your variable inside the click function. The way you had it initialized the variable, but didn't update the value on clicking the box.

Sign up to request clarification or add additional context in comments.

Comments

1

You need to put the length calculation inside the event handler, otherwise it's just going to be calculated once in the start and be 0 constantly.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.