I can enable and check all the fields on my form, but I can't have the fields enabled automatically! This is my code (now working):
$(document).ready(function(){
$("#lnk_checkall").click(function() {
if ($(this).attr("checked"))
{
$("input:checkbox.fb_chk").attr("checked", "checked");
$("input:checkbox.fb_chk").trigger("change");
}
else
{
$("input:checkbox.fb_chk").removeAttr("checked");
$("input:checkbox.fb_chk").trigger("change");
}
});
$("tr.photo_fb_item .fb_chk").change(function() {
var parent = $(this).parent().parent();
if ($(this).attr("checked") == "checked")
{
$("input.d", parent).removeAttr("disabled");
$("textarea.d", parent).removeAttr("disabled");
}
else
{
$("input.d", parent).attr("disabled", "disabled");
$("textarea.d", parent).attr("disabled", "disabled");
}
});
});
and this is my page:
$out .= '<input type="checkbox" name="checkall" id="checkall">Select All<br>';
$out .= '<tr class="photo_fb_item">'
. '<td><input type="checkbox" class="fb_chk" name="PICSOURCE[]" value="' . $item['source'] . '"/>'
can anyone add me the code to check all the boxes, please?