I would recommend using the attr() method of jquery like: checkbox.attr('checked') = !checkbox.attr('checked')
On Sep 26, 12:01 pm, chris <[EMAIL PROTECTED]> wrote: > I know there is a quirk with checkboxes, but I am under the impression > that setting the check state to boolean values within javascript takes > care of that. Unfortunately, this assumption is proving to be an > incorrect one. > > // Here is a snippet of code > $("li#" + liId).click(function(event){ > > var checkbox = $("#" + checkboxId) // this is being found as > expected > > // flip the checkbox state > console.log(checkbox.checked) > checkbox.checked = !checkbox.checked > > ====== End > > // This code snippet always returns Undefined even when the checkbox > is checked > console.log(checkbox.checked) > > // which then makes the flip of the values not work > checkbox.checked = !checkbox.checked > > What is the proper way to reference the checked value and flip the > value? > > Thanks.