Open In App

HTML | DOM Input Checkbox checked Property

Last Updated : 24 May, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

The DOM Input Checkbox Property is used to set or return the checked status of a checkbox field. This property is used to reflect the HTML Checked attribute. 

Syntax: 

  • It is used to return the checked property.
checkboxObject.checked
  • It is used to set the checked property.
checkboxObject.checked = true|false

Property Values: 

  • true: It defines that checkbox is in checked state.
  • false: It specify that the checkbox is not checked. It is false by default.

Return Value: It returns a boolean value which represents that whether the checkbox is checked or not. 

Example: This example illustrates how to return the Checkbox Checked Property. 

Output: 

Before clicking on the button:

  

After clicking on the button:

  

Example-2: This example illustrates that how to check and uncheck the checkbox. 

Output: 

Before clicking on the button: 

 

After clicking on the check button:

  

After clicking on the uncheck button:

  

Supported Browsers: The browser supported by DOM input Checkbox Checked Property are listed below:

  • Google Chrome
  • Edge 12 and above
  • Opera
  • Apple Safari
  • Mozilla Firefox

Next Article
Practice Tags :

Similar Reads