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:

Sets an access key to an element.
Specifies the initial state of a check box or a radio button.
Sets the style class or classes that belong to the element.
Sets whether the contents of the object are editable.
Sets the text direction as related to the lang attribute.
Sets the state of an object for user interaction.
Specifies whether a dotted rectangle (focus rectangle) is drawn around an object while it has focus.
Specifies the number of pixels to use as a margin at the left and right sides of the object.
Sets a unique identifier for the object.
Specifies the language of the element.
Sets the scripting language for the current element. Use it only for the script element.
Sets the name of a form control that affects the contents of the message submitted to the server.
Specifies the width of a control, in characters.
Sets an inline style associated with an element.
Specifies the tabbing order for keyboard navigation using the TAB key.
Specifies a tooltip for an element.
Sets the type of the input element.
Specifies the initial value for a control element.
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" />
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content