Dylan Verheul schrieb:
> 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?
I don't think that's intuitive. What if you really want to change the
value? You could't do that anymore...
$("#foo").attr('checked', true);
should work.
I'd like something like:
$("#foo").check();
$("#foo").uncheck();
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/