Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML command checked attribute

HTML checked attribute

HTML command Tag Reference HTML tag

Example

A pre-selected element:

onclick="setAlign('left')">Left

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Currently, almost all major browsers do not support the checked attribute.


Definition and Usage

The checked attribute is a boolean attribute.

The checked attribute specifies that the command element should be pre-selected when the page loads.

**Note:** This attribute can only be used when the command type is set to checkbox or radio, that is, only when type="checkbox" or type="radio".


Differences between HTML 4.01 and HTML5

The tag is new in HTML5.


Differences between HTML and XHTML

In XHTML, attribute minimization is forbidden; the checked attribute must be defined as .


Syntax


HTML command Tag Reference HTML tag