That's not my understanding as to how checkbox values work. If you
really want to uncheck a checkbox, you have to remove the checked
attribute - changing the value does /not/ have the same effect.

So, to uncheck it you could do:
$("#foo").removeAttr("checked");

--John

On 9/5/06, Dylan Verheul <[EMAIL PROTECTED]> wrote:
> I have a checkbox like this
>
> <input type="checkbox" id="foo" value="1" checked="checked" />
>
> I would expect this code to uncheck it:
> $("#foo").val(0); // any value != 1 should uncheck it
> and this code to check it
> $("#foo").val(1);
>
> It doesn't.
>
> The value attribute of a checkbox is imho not dynamic like a texbox's,
> but static, and can only be toggled to on or off.
>
> When manipulating form fields (don't get me started on radio button
> sets), jQuery seems to lose its beauty.
>
> Any ideas?
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>


-- 
John Resig
http://ejohn.org/
[EMAIL PROTECTED]

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to