Welcome to WebmasterWorld Guest from 54.146.221.231

Forum Moderators: incrediBILL

Message Too Old, No Replies

checkbox W3C Validation when checked

     
8:02 pm on Jan 16, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:July 4, 2007
posts: 183
votes: 0


I don't know what I'm doing wrong here but if I have my checkbox checked and then try to validate the html it fails with this error:

The value of the attribute is defined to be one of a list of possible values but in the document it contained something that is not allowed for that type of attribute. For instance, the “selected” attribute must be either minimized as “selected” or spelled out in full as “selected="selected"”; a value like “selected="true"” is not allowed.

My code is

<input type="checkbox" checked="yes" class="check" name="my-checkbox" value="my-checkbox" />

I'm using the XHTML 1.0 transitional doctype

Not quite sure why I've never run into this before - but then again, perhaps because I've never had the checkboxes checked on entry to the page.

Any help would be greatly appreciated
9:53 pm on Jan 16, 2011 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


It should read
checked="checked"
:)
10:16 pm on Jan 16, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:July 4, 2007
posts: 183
votes: 0


Thanks for that - I knew it'd be something as easy as that!