(#check_all) を追加するまで、私のスクリプトは非常にうまく機能しました。チェックボックスは機能しませんが、個別には正常に機能します。問題が見つかりません、助けてください。
私のスクリプト
<script type="text/javascript">
$(document).ready(function(){
$(".bt").click(function(){
$(".select_box").hide('fast');
if ($(this).next('.select_box').is(':visible')){
$(this).next(".select_box").hide('fast');
}
else{
$(this).next(".select_box").fadeIn('fast');
}
});
$(document).click(function() {
$(".select_box").hide();
});
$(".bt,.select_box").click(function(e) {
e.stopPropagation();
return false;
});
$('#check_all').click(function(){
$(this).parents('div:eq(0)').find(':checkbox').attr('checked', this.checked);
});
});
</script>
HTML
<a class="bt" href="#">[X]</a>
<div class="select_box" style="display:none;border:1px solid;">
<input id="check_entite" type="checkbox" />(Select All)<br />
<input type="checkbox" />1<br />
<input type="checkbox" />2<br />
</div>
<br><br>
<a class="bt" href="#">[X]</a>
<div class="select_box" style="display:none;border:1px solid;">
<input id="check_all" type="checkbox" />(Select All)<br />
<input type="checkbox" />1<br />
<input type="checkbox" />2<br />
</div>