Perfect sense. Thanks for the help.
On Sep 26, 3:47 pm, MorningZ <[EMAIL PROTECTED]> wrote: > "var checkbox = $("#" + checkboxId) // this is being found as > > > expected" > > The part you are missing is that "checkbox" is a jQuery object, not a > checkbox DOM object > > so: > > "checkbox.checked" > > sure would error because there is no ".checked" property of a jQuery > object > > so: > > checkbox[0].checked > > would work since the first item on a jQuery array is the DOM object > itself > > make sense? > > On Sep 26, 1: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.