In HTML checked is a boolean (of sorts), its presence is sufficient,
you don't need to set it to anything; if you want something unchecked
you should remove the 'checked' attribute. In XHTML, attribute
minimization is forbidden (i.e. attributes can't be empty), so the
proper syntax is checked="checked" (for disabled it's
disabled="disabled", etc.)

Use removeAttr() instead of setting the value to false.

On Feb 12, 8:26 am, Frederik Ring <frederik.r...@gmail.com> wrote:
> Hi!
>
> The thing is that somwhow (don't ask me why) the unchecked attribute
> of a checkbox is '' instead of 'false'.
>
> This worked fine with me:
> HTML:
> <input class="parentcheckbox" type="checkbox" checked="true"
> name="cb01"></input>
> <input class="childcheckbox" type="checkbox" checked="true"
> name="cb02"></input>
> <input class="childcheckbox" type="checkbox" checked="true"
> name="cb03"></input>
> <input class="childcheckbox" type="checkbox" checked="true"
> name="cb04"></input>
>
> jQuery:
> $(document).ready(function(){
>         $('.childcheckbox').change(function(){
>                 $(this).prev('.parentcheckbox').attr('checked','');
>         });
>
> });
>
> On Feb 12, 4:57 pm, Andy <adharb...@gmail.com> wrote:
>
> > Hey guys,
>
> > I'm trying to uncheck a checkbox that is inside my flexigrid.  I have
> > a checkbox in the header and the column has all checkboxes.  What I'm
> > trying to do is if I select the top checkbox (so all of the checkboxes
> > below are selected), I would like to uncheck that checkbox if any of
> > the other checkboxes in that column are unchecked.
>
> > I'm using the following code, but when it runs through this, it
> > unselects all of the items, instead of just the header.
>
> > Code snippet:
> > ================================================================
> > var rItem = document.getElementById("chk_col_" + colName);
> > $("inp...@name=" + rItem.name + "][type='checkbox']").attr('checked',
> > false);
> > ================================================================
>
> > The checkbox is named correctly, so I'm not sure why this isn't
> > working.
>
> > Thanks!

Reply via email to