65 of 133 menu

The checked attribute

The checked attribute makes a checkbox checkbox or a radio button radio checked by default.

Is an attribute without a value.

Example . Checkboxes

In the following example, two checkboxes are created: the first one will be checked (since it is given the checked attribute), and the second one will not:

<input type="checkbox" checked> <input type="checkbox">

:

Example . Radio switches

Let's make two radio switches - the first one will be checked (since we'll give it the checked attribute), and the second one won't:

<input type="radio" name="radio" checked> <input type="radio" name="radio">

:

See also

  • pseudo-class checked,
    which sets styles for the marked elements
  • attribute selected,
    which makes the select item checked
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline