Learn HTML by Building a Cat Photo App - Step 56

Instructions are to “Associate the text Loving with the checkbox by nesting only the text Loving in a label element and giving it an appropriate for attribute” and I’m being told “The text Loving should be wrapped in a label element.” It appears to be wrapped in a label so I’m not sure where the issue is coming from.

<html>
  <body>
    <main>
      <h1>CatPhotoApp</h1>
      <section>
        <h2>Cat Photos</h2>
        <!-- TODO: Add link to cat photos -->
        <p>See more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a> in our gallery.</p>
        <a href="https://freecatphotoapp.com"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
      </section>
      <section>
        <h2>Cat Lists</h2>
        <h3>Things cats love:</h3>
        <ul>
          <li>cat nip</li>
          <li>laser pointers</li>
          <li>lasagna</li>
        </ul>
        <figure>
          <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg" alt="A slice of lasagna on a plate.">
          <figcaption>Cats <em>love</em> lasagna.</figcaption>  
        </figure>
        <h3>Top 3 things cats hate:</h3>
        <ol>
          <li>flea treatment</li>
          <li>thunder</li>
          <li>other cats</li>
        </ol>
        <figure>
          <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg" alt="Five cats looking around a field.">
          <figcaption>Cats <strong>hate</strong> other cats.</figcaption>  
        </figure>
      </section>
      <section>
        <h2>Cat Form</h2>
        <form action="https://freecatphotoapp.com/submit-cat-photo">
          <fieldset>
            <legend>Is your cat an indoor or outdoor cat?</legend>
            <label><input id="indoor" type="radio" name="indoor-outdoor" value="indoor"> Indoor</label>
            <label><input id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> Outdoor</label>
          </fieldset>
          <fieldset>
            <legend>What's your cat's personality?</legend>

<!-- User Editable Region -->

            <input id="loving" type="checkbox"> <label for="Loving" </label>

<!-- User Editable Region -->

          </fieldset>
          <input type="text" name="catphotourl" placeholder="cat photo URL" required>
          <button type="submit">Submit</button>
        </form>
      </section>
    </main>
  </body>
</html>

<input id="loving" type="checkbox"> <label for="Loving" </label>

You haven’t closed off your opening label tag and the for attribute should match the input element’s id attribute exactly. The text ‘Loving’ should also be there as the text content of the label element (i.e. between the opening and closing tags).

Hello!
It appears the Loving text has been removed from the code.
As well, the for attribute loving should not be capitalized.

You are doing great!
Happy coding!

When you say that “loving” should be between the open and closing tags I’m not sure what you mean. Isn’t it already? With the label tags on either end.

The text ‘Loving’ is not between the opening and closing tags here. You’ve turned it into a for attribute, inside the opening label tag, which isn’t closed off properly (missing a >). You should have a for attribute but it should exactly match the id attribute of the input element.
You should ALSO have the text ‘Loving’ between the label tags.

So the code would looke like

<input id="loving" type="checkbox"> <label> for="loving" </label>

The first label tag is closed off and the for attribute is matching the id attribute in format. I’m getting the error " The new label element does not have a for attribute. Check that there is a space after the opening tag’s name."

The for attribute should be inside the opening label tag.
There should also be the text ‘Loving’ between the opening and closing label tags.

That worked. Thank you so much. I didn’t realize it needed to be literally inside the opening tag.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.