沒有你的代碼的例子,有點難以真正理解你想要的,但我會猜測。這裏是做一個「全選」複選框的一種方法:
HTML:
<input type="checkbox" class="select-all" name="select-all" id="select-all" value="select all" />
<label for="select-all">Select All</label>
<input type="checkbox" class="checkbox" name="checkbox1" id="checkbox1" value="1"/>
<input type="checkbox" class="checkbox" name="checkbox2" id="checkbox2" value="2"/>
<input type="checkbox" class="checkbox" name="checkbox3" id="checkbox3" value="3"/>
<input type="checkbox" class="checkbox" name="checkbox4" id="checkbox4" value="4"/>
<input type="checkbox" class="checkbox" name="checkbox5" id="checkbox5" value="5"/>
的jQuery:
$("#select-all").click(function(){
if ($(this).attr("checked") == "checked") {
$(".checkbox").attr("checked", "checked");
} else {
$(".checkbox").removeAttr("checked");
}
});
很難說沒有看到代碼,但我的猜測是,你需要使用.live()方法在facebox div中的複選框上,因爲facebox在頁面加載完成後呈現。 – charliegriefer