0

i have an issue with checkboxes and jquery. I set and event click on father(div) that check the checkbox, but if i click on checkbox directly it dosen't check.

You can find the code here: http://jsfiddle.net/vaxxis/65MBb/

Thanks.

3 Answers 3

3

How about that: http://jsfiddle.net/65MBb/8/ ?
All that is necessary - wrap inputs in label. Then do not need JavaScipt.

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

1 Comment

older versions of IE wont be able to understand what the label is for if you aren't using the 'for' attribute.
0

This happens because when you click the checkbox the event $('.ckb').click() is also fired. So it does get checked, but gets immediately unchecked again right afterwards because of your function.

So in your click() function you have to make sure that it was the div that was clicked and not the checkbox.

Comments

0

you can look what element was clicked, if its the input, don't run the script, else run it: http://jsfiddle.net/65MBb/14/

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.