I need help on this step: For the name, email, and number input fields inside the form I can see corresponding labels that describe the purpose of each field with the following ids: id=“name-label”, id=“email-label”, and id=“number-label”. Here is a link to my pen https://codepen.io/Jamescodes/pen/WNbEYVL.
look at the first line below the failed user story, it will give a clearer reason for which the user story is failing
for example you need to resolve this:
#name-label is not defined
It does say label not defined. How can I fix that?
do you have an element with that id
?
<label for="name">name:</label>
<input type="text" id="name" placeholder="Name" required>
<button type="submit">Submit</button>
<br></br>
<label for="email">email:</label>
<input type="email" id="email" placeholder="Email" required></input>
<button type="sumbit">Submit</button>
<br></br>
<label for="number">number:</label>
<input type="number" id="number" min=1 max=100 placeholder="Age">
<button type="submit">Submit</button>
the question stay, do you have an element with that id
? (do you remember what an id
is?)
I do know what an id is. I gave my labels names, and I matched them with the ids of the input elements.
and you did a good job there, but the user story is asking something else: you need to give a specific id to a specific element, and the id you need to use is the required one
I’m not sure why it says not defined because I gave the labels a for="name"or “email” or “number”. Does this not define them? If not, what does?
but have you ever used the required id? you need to use the #name-label
id
you never used that id, so it say it is not defined
Would that id be: id=“name-label”, id=“email-label”, and id=“number-label”?
well, that is what the user story say…
User Story #10: For the name, email, and number input fields inside the form I can see corresponding labels that describe the purpose of each field with the following ids:
id="name-label"
,id="email-label"
, andid="number-label"
.
So… I need to include the #name-label id in the label?
try to do it, see what happens
<label for="name-label">name:</label>
<input type="text" id="name-label" placeholder="Name" required>
<button type="submit">Submit</button>
<br></br>
I did this. I’m not sure if I’m just not understanding something or what, but now I only pass 4/17 of the tests.
it doesn’t seem you have given an id
to the label
element
why didn’t you do what you said?
I figured it out. I was a little confused between the for and the id. Thank you for your time!