A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-inputchecked-attribute/ below:

HTML <input>checked Attribute - GeeksforGeeks

HTML <input>checked Attribute

Last Updated : 11 Jul, 2025

The HTML <input checked> attribute is used with checkboxes or radio buttons to specify that the input should be selected (checked) when the page loads. It's a boolean attribute, meaning its presence implies "true."

Syntax
<input type = "checkbox|radio" checked> 

Example: In this example, we show the use of the checked attribute in checkboxes. The first checkbox is checked by default using checked, while the second checkbox is unchecked by default.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML <input>checked
        Attribute
    </title>
</head>

<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
    <h2>
        HTML <input>checked
        Attribute
    </h2>
    <form>
        <!-- Below input elements 
           have attribute "checked" -->
        <input type="checkbox" 
               name="check" 
               value="1" checked>
        Checked by default
        <br>
        <input type="checkbox" 
               name="check" value="2">
        Not checked by default
        <br>
    </form>
</body>

</html>

Output:

Supported Browsers:

The browser supported by HTML <input>checked Attribute are listed below:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4