Input Checkbox defaultChecked Attribute

Definition and Usage

defaultChecked The property returns the default value of the 'checked' attribute.

If the checkbox is selected by default, this property returns true, otherwise return false.

Example

Check if the checkbox is selected by default:

var x = document.getElementById("myCheck").defaultChecked;

Try It Yourself

Syntax

checkboxObject.defaultChecked

Technical Details

Return value: Boolean value. If the checkbox is selected by default, it returns true, otherwise return false.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support