HTMLInputElement: defaultChecked property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{ APIRef("HTML DOM") }}
The **defaultChecked** property of the {{DOMxRef("HTMLInputElement")}} interface specifies the default checkedness state of the element. This property reflects the {{htmlelement("input")}} element's [checked](/en-US/docs/Web/HTML/Reference/Elements/input#checked) attribute.
The boolean [checked](/en-US/docs/Web/HTML/Reference/Elements/input#checked) attribute is valid for the radio ([<input type="radio">](/en-US/docs/Web/HTML/Reference/Elements/input/radio)) and checkbox ([<input type="checkbox">](/en-US/docs/Web/HTML/Reference/Elements/input/checkbox)) input types. The presence of the attribute sets the defaultChecked property to true.
Value
A boolean.
Examples
const inputElement = document.getElementById("contactMail");
console.log(inputElement.defaultChecked);Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- {{HTMLElement("input")}}
- {{cssxref(":default")}} pseudo-class
- {{cssxref(":checked")}} pseudo-class