You are here: Reference > HTML > tags > input:checkbox

input:checkbox element

Browser support:
Creates a check box control.
The checkbox element allows the user to make multiple selections from a number of options. If you want to prohibit multiple selections, use the input:radio element.
This control is one of the form controls.
The state of the control can be submitted to a server if the following conditions are met:
  • A form element must contain the checkbox element.
  • The action attribute of the container form must be set to the URL of the server.
  • The name attribute of the check box must be specified and non-empty.
If the control is in checked state when the container form is submitted, the name of the check box is sent with the value of the value attribute. If the control is not checked, no information belonging to the check box is sent with the form. The default value of the value attribute is 'on' for check boxes, but the attribute is writable. Therefore, it is generally better not to use the 'on' constant value on the server side to examine the state of the check box. Check for only the existence of the parameter specified by the name of the checkbox and do not use its value.
If you want to see the HTML tags by categories, please visit this page.
This element cannot have a closing tag.
JavaScript page for this element: input:checkbox.

Possible members:

Attributes
Events
Styles
Pseudos
accessKey
Sets an access key to an element.
CHECKED
Specifies the initial state of a check box or a radio button.
class
Sets the style class or classes that belong to the element.
contentEditable
3
Sets whether the contents of the object are editable.
dir
Sets the text direction as related to the lang attribute.
DISABLED
Sets the state of an object for user interaction.
HIDEFOCUS
Specifies whether a dotted rectangle (focus rectangle) is drawn around an object while it has focus.
hSpace
Specifies the number of pixels to use as a margin at the left and right sides of the object.
id
Sets a unique identifier for the object.
lang
Specifies the language of the element.
language
Sets the scripting language for the current element. Use it only for the script element.
name
Sets the name of a form control that affects the contents of the message submitted to the server.
size
Specifies the width of a control, in characters.
style
Sets an inline style associated with an element.
tabIndex
Specifies the tabbing order for keyboard navigation using the TAB key.
title
Specifies a tooltip for an element.
type
Sets the type of the input element.
value
Specifies the initial value for a control element.
vSpace
Specifies the number of pixels to use as a margin at the top and bottom sides of an object.

Example HTML code 1:

This example illustrates the use of the check box element:
<form method="post" action="#URL#">
    <input type="checkbox" name="acceptAgreement" id="acceptAgreement" /> 
    <label for="acceptAgreement">I accept the User Agreement and Privacy Policy</label>
    <br /><br />
    <input type="submit" value="Register" />
</form>
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content