HTML DOM Input Checkbox required Property Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The Input Checkbox required property in HTML DOM is used to set or return whether the input checkbox field should be checked or not before submitting the form. This property is used to reflect the HTML-required attribute. Syntax:It returns the Input Checkbox required property.checkboxObject.required It is used to set the Input Checkbox required property.checkboxObject.required = true|false Property Values: Property Value Description true It is used to specify the checkbox must be checked before submitting the form. false It has a default value. It specifies that the checkbox must not be checked before submitting the form. Return Value: It returns a Boolean value which represents the checkbox must be checked or not before submitting the form. Example 1: This example show what value is returned by the Input Checkbox required property. html <!DOCTYPE html> <html> <head> <title> DOM Input Checkbox required Property </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM Input Checkbox required Property</h2> <form> <!-- Below input elements have attribute "required" --> <input type="checkbox" name="check" id="GFG" value="1" required> Checked by default<br> <input type="checkbox" name="check" value="2"> Not checked by default<br> </form> <br> <button onclick="checkRequired()"> Submit </button> <p id="sudo" style="color:green;font-size:20px;"></p> <!-- Script to use required property --> <script> function checkRequired() { let isRequired = document.getElementById("GFG").required; document.getElementById("sudo").innerHTML = isRequired ? "Checkbox is required." : "Checkbox is not required."; } </script> </body> </html> Output: Example 2: This example sets the Input Checkbox required property. html <!DOCTYPE html> <html> <head> <title> HTML DOM Input Checkbox required Property </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM Input Checkbox required Property</h2> <form onsubmit="return validateForm(e)"> <!-- Single checkbox with attribute "required" --> <input type="checkbox" name="check" id="GFG" value="1" required> Checked by default<br> <br> <button type="submit"> Submit </button> </form> <br> <!-- Script to validate and submit form --> <script> function validateForm() { var checkbox = document.getElementById("GFG"); if (!checkbox.checked) { // If checkbox is not checked, prevent form submission document.getElementById("sudo").innerHTML = "Checkbox is required!"; return false; } } </script> </body> </html> Output: HTML DOM PropertyHTML DOM Input Checkbox value Property HTML DOM Input Checkbox form Property HTML DOM Input Checkbox checked PropertySupported Browsers: Google Chrome 1Edge 12Firefox 1Opera 15Safari 1 Comment More infoAdvertise with us Next Article HTML DOM Input Checkbox value Property M manaschhabra2 Follow Improve Article Tags : Misc Web Technologies HTML HTML-DOM Practice Tags : Misc Similar Reads HTML DOM Input Checkbox value Property HTML DOM Input Checkbox Value property sets or return the value of the value attribute of an input checkbox field, however the contents of the value attribute does not shown to user. It manages their assigned value, reflecting their state when checked or unchecked. It retrieves or sets the value att 3 min read HTML | DOM Input Date required Property The Input Date required property is used for setting or returning whether a date field must be filled out before submitting a form. The HTML required attribute is used to reflect the Input Date required property.Syntax: For returning the required property: dateObject.requiredFor setting the required 2 min read HTML | DOM Input Checkbox type Property The Input Checkbox type Property in HTML DOM is used to return that which type of form element the checkbox is. For a checkbox input field, this Property was always return only "checkbox". Syntax: checkboxObject.type Return Value: It returns a string value which represents the type of form element t 1 min read HTML | DOM Input URL required Property The DOM Input URL required Property in HTML DOM is used to set or return whether Input url Field should be filled or not when submitting the form. This property is used to reflect the HTML required attribute.Syntax: It returns the Input url required property. urlObject.requiredIt is used to set the 2 min read HTML | DOM Input Datetime required Property The Input Datetime required property is used to check whether a datetime field must be filled out or not before submitting a form. Syntax: For returning the required property:datetimeObject.requiredFor setting the required property: datetimeObject.required = true|false Property Value: true|false : I 2 min read HTML DOM Input Tel required Property The DOM input tel required property in HTML DOM is used to set or return whether the input tel field should be filled or not when submitting the form. This property is used to reflect the HTML required attribute. Syntax: It returns the input tel required property. telObject.requiredIt is used to set 1 min read Like