Create a Set of Radio Buttons´Question to Options

Tell us what’s happening:

Just a quick Question, there are 2 ways to write it, one with only the other option is to write it with <label for= … Which of these Options SHOULD I usually do, and why? I’ve been stuck on this first and got confused whats better now, can someone help me at this? I beat it. but I still wanna know why.

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">Indoor</label>

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

    
    
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</main>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.151.

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

Don’t understand your question as worded.The value of the for attribute creates a link to the id attribute of the input element so that the text of the label such as Indoor can be clicked instead of the radio button which is easier for some users.

Well you do it can only with and you can do it with <label for= … Is there any reason to do it with only ? Should I just do this with <label for all the time? thats what i mean.