I have a little issue, if i select an single checkbox and press f5 the state of the checbox will remain(so it will be checked) but if i use jQuery to select all checkboxes on a page and then press f5 all of the checkboxes will blank(so uncheck, only the one’s that are handpicked will remain in there state). How can i solve this, so that when i hit refresh everything will remain the same?
the code
jQuery('.sellectall').click(function(){
$('input:checkbox').attr('checked',true);
});
I assume you’re using jQuery 1.6 or later.
If so, use the
prop()[docs] method instead of theattr()[docs] method.Then you should get the same behavior as if a user clicked the box.
…or set the
checkedproperty manually: