What is the syntax for a checked checkbox in HTML?

Posted by Fiona Holder on Stack Overflow See other posts from Stack Overflow or by Fiona Holder
Published on 2010-05-20T14:58:57Z Indexed on 2010/05/20 15:00 UTC
Read the original article Hit count: 229

Filed under:
|
|

Sounds like a bit of a silly question, but I am wondering what is the best way of stating that a checkbox is checked/unchecked in HTML.

I have seen many different examples:

<input type="checkbox" checked="checked" />
<input type="checkbox"  />

<input type="checkbox" checked="yes" />
<input type="checkbox" checked="no" />

<input type="checkbox" checked="true" />
<input type="checkbox" checked="false" />

Which browsers work with which ones of these, and most importantly, does jQuery figure out which box is checked in all 3?

© Stack Overflow or respective owner

Related posts about html

Related posts about checkbox