Check Radio Buttons n Checkboxes by Default

Hi everyone, I’m trying to make the first radio button “checked” and then the first label input checked and I’m not doing something right, can someone give me a hint? The hint button isn’t working for me when i click it

Your code so far

<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"> checked</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality">
    checked</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 (Linux; Android 7.0; SAMSUNG SM-G930T Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/6.4 Chrome/56.0.2924.87 Mobile Safari/537.36.

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

To do this, just add the word “checked” to the inside of an input element. For example:
<input type="radio" name="test-name" checked>

It doesn’t look like you’re adding the checked inside of the input element

1 Like

I just want to add some references about <input> and the checked attribute complementing gebulmer’s answer.
MDN Web Docs "<input>"
W3schools “checked attribute”

Add the attribute checked="checked" into your input. Or you can simply add the word checked :slight_smile:

I just put the word checked after where it says input type=

Thank you, got it figured out a lil bit ago