checkbox

< html‎ | elements‎ | input‎ | type
Jump to: navigation, search

checkbox

This article is Not Ready.



Summary

The checkbox type of the <input> element represents a state or option that can be toggled.


Overview Table

DOM Interface HTMLInputElement

Examples

HTML

<input type="checkbox" name="vehicle" value="Bike"> I have a bike
<input type="checkbox" name="vehicle" value="Car"> I have a car

Notes

Remarks

When an input type=checkbox element is selected, a name/value pair is submitted with the form. The default value of input type=checkbox is on. The height and width styles are exposed to the input type=checkbox element. The size of the element is set based on the values provided by the author, subject to a particular minimum. The size is calculated as follows:

  • If the height or width is greater than 20 pixels, the padding around the check box is set to 4 pixels, and the inner height or width is set to 8 pixels.
  • If the height or width is less than 20 pixels but greater than 13 pixels, the padding around the check box is equal to one half the specified height or width minus 13. For example, if the specified width of the check box is 17, the equation would be: (17-13)/2.
  • If the height or width is less than 12 pixels, the padding around the check box is set to 0 and the inner width is set to the value specified by the author.

Note  For code samples, see Form controls part 1 and Form controls part 2: validation on the Windows Internet Explorer sample site. In IE8 Standards mode and later, inserting an input type=checkbox object into the Document Object Model (DOM) tree does not reset the defaultChecked property. For more information, see Defining Document Compatibility.

Standards information


HTML information

{

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic Support 1.0
1.0
2
1.0
1.0

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic Support Supported (when?)
Supported (when?)
Supported (when?)
Supported (when?)
Supported (when?)
Supported (when?)
Supported (when?)
Supported (when?)

See also

Related pages (MSDN)

  • input

Attribution

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]