Basic HTML and HTML5: Check Radio Buttons and Checkboxes by Default

Tell us what’s happening:
I can’t seem to get a hang of it I don’t know why can someone please help?

Your code so far


<h2>CatPhotoApp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></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 for="indoor"><input id="indoor" type="radio" name="indoor-outdoor" value="indoor"> Indoor</label>
  <label for="outdoor"><input id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> Outdoor</label><br>
  <label for="loving"><input id="loving" type="checkbox" name="personality" value="loving"> Loving</label>
  <label for="lazy"><input id="lazy" type="checkbox" name="personality" value="lazy"> Lazy</label>
  <label for="energetic"><input id="energetic" type="checkbox" name="personality" value="energetic"> Energetic</label><br>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
</main>

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 12871.76.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.103 Safari/537.36.

Challenge: Check Radio Buttons and Checkboxes by Default

Link to the challenge:

Once we have the keyword ‘checked’ mentioned in the the radio button/checkbox is checked by default when the web page appears to the user and can be edited by the user later on. To get better understanding i advice you to format your code better to your understanding.

thx exept I still don’t really understand.
Where should I put the code?

put the key word checked in the position mentioned below < input id=“indoor” type=“radio” name=“indoor-outdoor” value=“indoor” checked>

P.S: remove the white space placed at the start of input tag.

thx this will help :wave:

Do I put this code inside the form? :face_with_raised_eyebrow:

thx for the help I passed so happy :laughing: :grin:

1 Like

You are welcome ! Happy ta Help :slight_smile: