JAVASCRIPT:
$("input").filter("[@id=select_all]").click(function(){
if (this.checked){
//checked
$("input[@name='check_[]']").each(function(){
var d = $(this).attr("disabled");
if (d == false){
this.checked = true;
}
});
}else{
//unchecked
$("input[@name='check_[]']").each(function(){
this.checked = false;
});
}
})
HTML:
<input type="checkbox" id="select_all">
<input type="checkbox" name="check_[]" id="check1">
<input type="checkbox" name="check_[]" id="check2">
<input type="checkbox" name="check_[]" id="check3">
沒有留言:
張貼留言