Hello all!
I am working in a function that selects all check-boxes based on a class and sets their status to checked but nothing happens, jQuery is loading properly because other functions work fine, also firebug throws no errors my function is this:
todoSelectAll is another checkbox, todoGA is the class applied to a group of checkboxes, I have been having trouble selecting all elements with a specified class, can someone help me figure out what is wrong with my syntax
I don’t know if jQuery has a problem selecting check-boxes by using the class name or it just won’t select them in my current environment, it might have to do with my Joomla since it also loads Mootools but I am not sure, I will do some tests without Mootools and post here the results
I think you were over thinking your code a little bit as you have made it more complex then it needed to be, so you can see what i mean see the following link.
That does work but it does not really toggle the selection it just checks or unchecks all checkboxes based on the state of the toggle checkbox, what if I wanted to iterate over each and do it based on a case situation, if checked uncheck and if unchecked check, although I did overdo because I could not iterate based on the class name, now that I see your code I did this: http://jsfiddle.net/UC7ex/ thank you for your help
I posted both code snippets and the results show that performance wise the code by Muazzez is faster although not by much, and having firebug disabled shows Chris snippet faster.
I usually don’t run any performance tests but was wondering why Chris would offer the function as a better option than each, besides being better performance what else is there, also I agree with you it is better to understand what the code does