Jquery H3问题将在稍后讨论,我希望这个答案有效。这确实符合我的意图。 function changeH3(){ $('h3').on('click',function(){ var boxes = $('.checkbox[type="checkbox"
H3问题将在稍后讨论,我希望这个答案有效。这确实符合我的意图。Jquery H3问题将在稍后讨论,我希望这个答案有效。这确实符合我的意图。 function changeH3(){ $('h3').on('click',function(){ var boxes = $('.checkbox[type="checkbox",jquery,css,accordion,Jquery,Css,Accordion,H3问题将在稍后讨论,我希望这个答案有效。这确实符合我的意图。 function changeH3(){ $('h3').on('click',function(){ var boxes = $('.checkbox[type="checkbox"]'); if ( boxes.length === boxes.filter(':checked').length ) { $(this).closest('h3') .toggleClass('bg-
function changeH3(){
$('h3').on('click',function(){
var boxes = $('.checkbox[type="checkbox"]');
if ( boxes.length === boxes.filter(':checked').length ) {
$(this).closest('h3')
.toggleClass('bg-warning')
.toggleClass('bg-success');
}
});
}
<div id= "acc1" >
<form role="form" action="run.php" method="post" name='details'>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="1" onClick="checkval(this)" <?php echo $boxes[1] ? 'checked = "checked"' : '' ?>>Inspected
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="2" onClick="checkval(this)"<?php echo $boxes[2] ? 'checked = "checked"' : '' ?>>All
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="3" onClick="checkval(this)"<?php echo $boxes[3] ? 'checked = "checked"' : '' ?>>All
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="4" onClick="checkval(this)"<?php echo $boxes[4] ? 'checked = "checked"' : '' ?>>aligns
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="5" onClick="checkval(this)"<?php echo $boxes[5] ? 'checked = "checked"' : '' ?>>and
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="6" onClick="checkval(this)"<?php echo $boxes[6] ? 'checked = "checked"' : '' ?>> match
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="7" onClick="checkval(this)"<?php echo $boxes[7] ? 'checked = "checked"' : '' ?>>free
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="8" onClick="checkval(this)"<?php echo $boxes[8] ? 'checked = "checked"' : '' ?>>Front
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="9" onClick="checkval(this)"<?php echo $boxes[9] ? 'checked = "checked"' : '' ?>>Weather
</fieldset>
<fieldset class="form-horizontal form-group bg-info">
<input type="checkbox" class="box " name="checkBox[]" id="10" onClick="checkval(this)"<?php echo $boxes[10] ? 'checked = "checked"' : '' ?>>Key
</fieldset>
<textarea class= "form-control notes" name="notes[]" data-num="1" onChange="getVal(this)" placeholder = "If any of the above items were , etc."><?php echo $notes[1] ? $notes[1] : '' ?></textarea>
</div>
$('input[type="checkbox"]').click(function (event) {
$target = $(this);
$parent = $target.closest('.panel') // this selector may be incorrect
$h3 = $target.find('h3');
$checkboxes = $parent.find('input[type="checkbox"]');
$checked = $parent.find('input[type="checkbox"]:checked');
if ($checked.length == $checkboxes.length) {
$h3.addClass('bg-success');
$h3.removeClass('bg-warning');
} else {
$h3.removeClass('bg-success');
$h3.addClass('bg-warning');
}
});