
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Input Checkbox checked Property
The HTML DOM input checkbox checked property returns and alter the value of checked attribute of a checkbox in HTML.
syntax
Following is the syntax −
1. Returning checked
object.checked
2. Altering checked
object.checked = true|false
Example
Let us see an example of HTML DOM Input Checkbox checked property −
<!DOCTYPE html> <html> <head> <title>HTML DOM checked property</title> <style> body{ text-align:center; } p{ font-size:1.5rem; color:#ff8741; } input{ width:30px; height:30px; } button{ background-color:#db133a; color:#fff; padding:8px; border:none; width:120px; margin:0.5rem; border-radius:50px; outline:none; } </style> </head> <body> <h1>checked Property Example</h1> <p>Are you happy?</p> <input type="checkbox"> <br> <button onclick="yes()">Yes</button> <button onclick="no()">No</button> <script> function yes() { document.querySelector("input").checked = true; } function no() { document.querySelector("input").checked = false; } </script> </body> </html>
output
This will produce the following output −
Click on “Yes” button to check the box.
Now, click on “No” button to uncheck the box.
- Related Articles
- HTML DOM Input Radio checked Property
- HTML DOM Input Checkbox defaultChecked Property
- HTML DOM Input Checkbox autofocus Property
- HTML DOM Input Checkbox disabled Property
- HTML DOM Input Checkbox form Property
- HTML DOM Input Checkbox name Property
- HTML DOM Input Checkbox required Property
- HTML DOM Input Checkbox type Property
- HTML DOM Input Checkbox value Property
- HTML DOM Input Checkbox Object
- HTML DOM Input Button type Property
- HTML DOM Input Button value Property
- HTML DOM Input Button name Property
- HTML DOM Input Button disabled Property
- HTML DOM Input Button form Property

Advertisements