I\'m trying to check whether or not all the visible check boxes in a certain series are checked and i thought of just counting those that are visible and those that are visible
This works fine for me.
$(".inputClass:checked:visible");
$(".inputClass:checked:visible").length;
OR adapting the above answer.
jsfiddle
$('input:visible:checked').each(function() {
$(this).wrap('<div />');
});
This is incorrect:
if($j("input[id^='chk_camp']").filter(':visible').filter(':checked).length == $j("input[id^='chk_camp']).filter(':visible').length)
// ------^------ missing qoutes here ----^--- also double quotes here
You could do something like this:
jsfiddle
jQuery:
$('input').each(function() {
// If input is visible and checked...
if ( $(this).is(':visible') && $(this).prop('checked') ) {
$(this).wrap('<div />');
}
});
HTML:
<input type="checkbox" checked="checked">
<input type="checkbox" checked="checked" style="display: none;">
<input type="checkbox">
<input type="checkbox" checked="checked" style="display: none;">
<input type="checkbox" checked="checked">
<input type="checkbox">
CSS:
div { float: left; background: green; }
div input { display: block !important; }