HTML submission error?

I received this message:

Unfortunately you did not receive a passing score on your latest module, HTML/CSS Assessment. Your score was 11 / 12.

Remember, you’re allowed three re-take attempts between all modules. You have currently used 2 out of 4 attempts. To continue, please retake the module, HTML/CSS Assessment, in the prepwork.

As a reminder, you’ve completed 0 out of 3 total modules. Once all three modules are complete, you’ll be able to join an upcoming cohort.

The questions you missed were:

* has exactly one input with a name of ‘pet_name’ and an associated label with the content ‘Name’

I have reviewed that part of the code up and down, and I have come to the conclusion that in my original code, it said the following

      <label for="Name"> Name</label>

      <input type="text" id="name" name="pet_name">

    </div>

I deleted the space before “Name” because I believe that is what was causing my code to malfunction. However upon fixing it to this

      <label for="Name">Name</label>

      <input type="text" id="name" name="pet_name">

    </div>

I still get an error message. I dont understand what is going on. I really dont want another strike this early on…

You want your label’s for attribute to point to the input you’re labeling:

The Label element is “for” the input element, so make sure the label’s “for” attribute points to the id of the input it’s describing (exactly):

  <label for="name">Name</label>
  <input type="text" id="name" name="pet_name">

Above, you’ll see that the input’s id attribute is “name”, so the label for the input should say for=“name”, because it’s labeling the input with an id of “name”.

In your example, if you change the for attribute to say “name” (with a lowercase n) instead of “Name” (with an uppercase N), you should be g2g.

2 Likes

thank you very much for the help, gdevl, your help is greatly appreciated

My issue with this solution however, is that I use different attributes of the for= attribute and id=attribute in another section

      <label for="biography">Biography</label>

      <textarea id="bio" name="pet_bio"></textarea>

    </div>

and did not receive any points off

That I cannot explain, but I will say I dug into this a little more, and I’m not convinced that I was correct after all:

HTML REFERENCE - LABEL

Looks like you can deploy a label element a few different ways.

1 Like

in your opinion, is the “for” attribute essential, or is it something that can be omitted without much consequence?

I used a “for” attribute for every input element used in the HTML/CSS assessment’s index.html and passed it without issue. I can’t say for sure what the grading script is looking for in your code, but I’m guessing the form specifications denoted on the assessment page are the part you need to focus on. By that I mean: if the specifications don’t explicitly ask for a “for” attribute, it’s probably not essential.

Hey Cosmos,

I am having the same issue with my HTML project. Did you resubmit with changed to “name”? If so, did that fix your issue? The instructions had name capitalized when referring to the label, so I thought that is what they wanted.

I’m starting to think that some of these assessments, instructions, etc, are intentionally written in a way for us to not just follow directions, but think critically and problem solve. The more we work through the problems and debug our own issues, the more proficient we are and have a better understanding of things.