Tell us what’s happening:
Currently working on certificate projects (Build a survey form). My code do not seem to be wrong. All test have passed, remaining test 10 which says:
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”, and id=“number-label”. #name-label is not defined : expected null to not equal null
AssertionError: #name-label is not defined : expected null to not equal null
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
Note: Backticks are not single quotes.
The for attribute value on the label should match the id value on the input.
…
Thank you Lasjorg for that correction and solution, but the problem is that test(4) wants me to specify label-id as=“label-name” while test (10) wants the input-id to be =“name”. So if i match label id and input id to be the same, one of the test keeps failing.
…
you can’t have multiple elements with the same id, that’s correct
but the for attribute of the label should match the id of the input element
you have not given an id to your label elements
you are also not using the label elements, you should put the text in the labels, instead of in a paragraph, so that clicking on the text will select the input element
**User Story #4:** Inside the form element, I am required to enter my name in a field with `id="name"` .
...
**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"` , and `id="number-label"` .
...
If test 4 pass, test 10 fails and vice-versa due to the different id's. If i use the same id for label and input field, one must fail