# Check Radio Buttons and Checkboxes by Default, Help

**URL:** <https://forum.freecodecamp.org/t/check-radio-buttons-and-checkboxes-by-default-help/177663>\
**Category:** General\
**Created:** [March 3, 2018, 7:42am UTC](https://forum.freecodecamp.org/t/check-radio-buttons-and-checkboxes-by-default-help/177663 "2018-03-03T07:42:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taximan](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/taximan/32/160438_2.png) [@Taximan](https://forum.freecodecamp.org/u/Taximan)\
**Post date:** [March 3, 2018, 7:42am UTC](https://forum.freecodecamp.org/t/check-radio-buttons-and-checkboxes-by-default-help/177663/1 "2018-03-03T07:42:03Z")

</div>

**Tell us what’s happening:**  
I was looking for and example so I can get a hint. Found none at this time.

**Your code so far**

```auto
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }

  .thick-green-border {
    border-color: green;
    border-width: 10px;
    border-style: solid;
    border-radius: 50%;
  }

  .smaller-image {
    width: 100px;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p>Click here for <a href="#">cat photos</a>.</p>

<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back. " src="https://bit.ly/fcc-relaxing-cat"></a>

<p>Things cats love:</p>
<ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
  <li>flea treatment</li>
  <li>thunder</li>
  <li>other cats</li>
</ol>
<form action="/submit-cat-photo">
  <label><input type="radio" name="indoor-outdoor"> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality"> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>

```

**Your browser information:**

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299`.

**Link to the challenge:**  
[https://www.freecodecamp.org/challenges/check-radio-buttons-and-checkboxes-by-default](https://www.freecodecamp.org/challenges/check-radio-buttons-and-checkboxes-by-default)

---

<div class="post-metadata">

**Author:** ![robroy007](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/robroy007/32/81458_2.png) [@robroy007](https://forum.freecodecamp.org/u/robroy007)\
**Post date:** [March 3, 2018, 9:18am UTC](https://forum.freecodecamp.org/t/check-radio-buttons-and-checkboxes-by-default-help/177663/2 "2018-03-03T09:18:00Z")

</div>

check this link for the code snippet and check yours:

> **[Create a Set of Checkboxes](https://codepen.io/SG_Novice/pen/KQYqNr)**
>
> ...

Hope it helps.

---

<div class="post-metadata">

**Author:** ![ChaitanyaRajeev](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/chaitanyarajeev/32/160618_2.png) [@ChaitanyaRajeev](https://forum.freecodecamp.org/u/ChaitanyaRajeev)\
**Post date:** [March 3, 2018, 11:29am UTC](https://forum.freecodecamp.org/t/check-radio-buttons-and-checkboxes-by-default-help/177663/3 "2018-03-03T11:29:06Z")

</div>

What actually is the error

---

<div class="post-metadata">

**Author:** ![Taximan](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/taximan/32/160438_2.png) [@Taximan](https://forum.freecodecamp.org/u/Taximan)\
**Post date:** [March 5, 2018, 6:05am UTC](https://forum.freecodecamp.org/t/check-radio-buttons-and-checkboxes-by-default-help/177663/4 "2018-03-05T06:05:37Z")

</div>

You can set a checkbox or radio button to be checked by default using the checked attribute.  
To do this, just add the word “checked” to the inside of an input element. For example:  
  
Set the first of your radio buttons and the first of your checkboxes to both be checked by default.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:25pm UTC](https://forum.freecodecamp.org/t/check-radio-buttons-and-checkboxes-by-default-help/177663/5 "2021-01-17T20:25:11Z")

</div>

Closed on January 17, 2021, 8:25pm UTC


