Revision: 19941
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 3, 2009 13:13 by jasonseney
Initial Code
var checkBoxes = $(':checkbox');
var allAreSelected = (function() {
for (i in checkBoxes.get()) {
if (!checkBoxes[i].checked) {
return false;
}
}
return true;
})();
Initial URL
Initial Description
Returning a boolean inside of jQuery's $.each() function will only break the loop. To get a return value, you can convert the jQuery object to array and use a regular for loop in javascript.
Initial Title
Loop on jQuery object and return value
Initial Tags
javascript, jquery
Initial Language
JavaScript