I just would like to check all my checkboxes with JQuery. These checkboxes are created with JSF.
I tried :
$("input[type=checkbox]").each(
function() {
$(this).prop('checked', true);
// OR
$(this).attr('checked', true);
// OR
$(this).attr('checked', 'checked');
alert($(this).attr('id'));
}
);
nothing works…
Can JSF be the problem ? Value of these checkboxes are linked with some managed bean boolean value.
Thanks for help.
PS : my alert() function returns id of checkboxes properly and JQuery version is :
jQuery JavaScript Library v1.8.1
Ok, I think I have understood the problem…
when I try this code :
I have always
truevalues but I see some checkboxes unchecked…So values are changed but visual stay the same. It’s because I use JSF and it’s folowwed render :
This checkox is made of some CSS background etc…
So I have to change CSS of parent div (with background…) to make this checkox checked visually since its value is already set to true.
It was just a visual problem, not value problem.
Thank you