HOW TO MAKE RADIO Buttons answer

Tell us what’s happening:

‘how to put radio buttons and answer’

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
Submit


**Your browser information:**

User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362</code>.

**Challenge:** Create a Set of Radio Buttons

**Link to the challenge:**
https://www.freecodecamp.org/learn/responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons

Try the hints here: freeCodeCamp Challenge Guide: Create a Set of Radio Buttons

If you are still stuck; someone will try to help :slight_smile: just post your current code in a response with 3 back ticks ``` (shift ~ button)

Or for whoever doesn’t have it on the keyboard: ALT + 96


Here is my solution for that

5 Likes
Indoor Outdoor
1 Like
<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">
    <input type="text" 
placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
    
<label for="Indoor"> 
  <input id="Indoor" type="radio" name="indoor-outdoor">Indoor
  </label>

<label for="Outdoor"> 
  <input id="Outdoor" type="radio" name="indoor-outdoor">Outdoor 
  </label>
</form>

</main>

It keeps giving me the error that each label element must have a closing tag.  Am I missing something?
1 Like

Figured it out, the code was correct, I had a in a comment i had added at the bottom of the document. Doh.

for the create radio button you should know 2 tip.
first input element have type=“radio” attribute it create radio buton.
second input name should be same other wise you choose both button then no meaning radio button its turn checkbox.
example:
<input type=“radio” name=“color”< white
<input type=“radio” name=“color”< black
note:when ı write <input(>) my writing is not visible.

Thanks alot This solution really helped and allowed me to continue with the program