Failed:Your #name-label
should contain text that describes the input.
Failed:Your #email-label
should contain text that describes the input.
Failed:Your #number-label
should contain text that describes the input.
not sure what it means to include a label to each input
<!DOCTYPE html>
<html lang="en"></html>
<head>
<meta charset="UTF-8">
<title>Build a Survey Form</title>
<link rel="stylesheet" href="styles.css"/>
</head>
<body>
<h1 id="title">Survey Form</h1>
<p id="description">freeCodeCamp User Experience Form</p>
<form action="https://survey-form.freecodecamp.rocks" id="survey-form"
>
<label for="name" name="name"> Enter Your Name: <input
id="name"
type="text"
name="name"
placeholder="Name"required>
<label for="email" name="email" >Enter Your Email:<input
id="email" type="email"
name="email"
placeholder="Email" required>
<label
<label for="number" name="age" >Enter Your Age: <input
id="number"
type="number" name="number" min="13" max="120"
placeholder="13" /></label>
<legend>What option best describes you?</legend>
<select id="dropdown" name="describe">
<option placeholder=
"select one" value="">(select one)</option>
<option>Student</option>
<option>Full-time job</option>
<option>Other</option></select>
<fieldset>
<legend>Would you recommend freeCodeCamp to a friend?</legend>
<label for="definitely"><input id="definitely" type="radio" name="definitely-possibly" value="definitely" checked>Definitely</label>
<label for="possibly"><input id="possibly" type="radio" name="definitely-possibly" value="possibly" >Possibly</label>
</fieldset>
<legend>What is your favorite feature of freeCodeCamp? </legend>
<select id="dropdown">
<option value="checkbox">(select one)</option>
<option>Challenges</option>
<option>Projects</option>
<option>Community</option>
<option>Other</option>
</select>
<fieldset>
<legend>What would you like to see improve?</legend>
<label for="videos">
<input id="videos" value="videos"
type="checkbox" type="inline" name="improve" checked>Videos</label>
<label for="forum">
<input id="videos" value="videos"
type="checkbox"type="inline" name="improve">Forum</label>
<label for="front-end-projects">
<input id="front-end-projects" type="checkbox"
name="improve" value="front-end-projects">
Front-end Projects</label>
<label for="back-end-projects">
<input id="back-end-projects" type="checkbox"
name="improve" value="back-end-projects">
Back-end Projects</label>
<label for="additional-courses">
<input id="additional-courses" type="checkbox"
name="improve" value="additional-courses">
Additional Courses</label>
</fieldset>
<legend>Any comments or concerns?</legend>
<textarea id="bio" name="bio" rows="3" cols="50" placeholder="Enter you comment here..."></textarea>
<input id="submit" type="submit" value="Submit" />
</form>
<input
id="name-label"
id="email-label"
id="number-label">
</body>
</html>
I’ve edited your code 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.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
2 Likes
Each input has a label associated with it.
For example, here is your name label
and here is the input it is associated with
It doesn’t look like you have a proper closing tag like this </label>
so you will need to go through your entire html document and make sure the html is correct.
You can use tools like HTML validator to help with that
For each label, you should have an id like name-label
, email-label
, etc
1 Like
Also, you can’t have multiple ids in an input like this
1 Like
I was wondering, thank you
<label for="name" name="name"> Enter Your Name: <input
id="name"
id="name-label"
type="text"
name="name"
placeholder="Name"
required></label>
I closed the code with </label>
and added an additional id=“name” even though that doesn’t seem right, because once I run it I end up having less errors.
Still getting this though
Failed:You should have a label
element with an id
of name-label
.
Clearly I included id=“name-label”
You should only have one id attribute and one value
For example:
<label for="example">
<input id="example">
</label>
1 Like
I’ve made those adjustments, but I don’t understand why the code is requiring this label>>>You should have a label
element with an id
of name-label
.
<!DOCTYPE html>
<html lang="en"></html>
<head>
<meta charset="UTF-8">
<title>Build a Survey Form</title>
<link rel="stylesheet" href="styles.css"/>
</head>
<body>
<h1 id="title">Survey Form</h1>
<p id="description">freeCodeCamp User Experience Form</p>
<form action="https://survey-form.freecodecamp.rocks" id="survey-form">
<label for="name" name="name"> Enter Your Name: <input
id="name"
type="text"
name="name"
placeholder="Name"
required></label>
<label for="email" name="email" >Enter Your Email:<input
id="email" type="email"
name="email"
placeholder="Email" required></label>
<label
for="number" name="age" >Enter Your Age: <input
id="number"
type="number" name="number" min="13" max="120"
placeholder="13"
/></label>
<legend>What option best describes you?</legend>
<select id="dropdown" name="describe">
<option placeholder=
"select one" value="">(select one)</option>
<option>Student</option>
<option>Full-time job</option>
<option>Other</option></select>
<fieldset>
<legend>Would you recommend freeCodeCamp to a friend?</legend>
<label for="definitely"><input id="definitely" type="radio" name="definitely-possibly" value="definitely" checked>Definitely</label>
<label for="possibly"><input id="possibly" type="radio" name="definitely-possibly" value="possibly" >Possibly</label>
</fieldset>
<legend>What is your favorite feature of freeCodeCamp? </legend>
<select id="dropdown">
<option value="checkbox">(select one)</option>
<option>Challenges</option>
<option>Projects</option>
<option>Community</option>
<option>Other</option>
</select>
<fieldset>
<legend>What would you like to see improve?</legend>
<label for="videos">
<input id="videos" value="videos"
type="checkbox" type="inline" name="improve" checked>Videos</label>
<label for="forum">
<input id="videos" value="videos"
type="checkbox"type="inline" name="improve">Forum</label>
<label for="front-end-projects">
<input id="front-end-projects" type="checkbox"
name="improve" value="front-end-projects">
Front-end Projects</label>
<label for="back-end-projects">
<input id="back-end-projects" type="checkbox"
name="improve" value="back-end-projects">
Back-end Projects</label>
<label for="additional-courses">
<input id="additional-courses" type="checkbox"
name="improve" value="additional-courses">
Additional Courses</label>
</fieldset>
<legend>Any comments or concerns?</legend>
<textarea id="bio" name="bio" rows="3" cols="50" placeholder="Enter you comment here..."></textarea>
<input id="submit" type="submit" value="Submit" />
</form>
</body>
</html>
Inside the opening label tag you need to have an id
Right now you have zero ids
You need to add an id called name-label to pass the test.
Same goes for the email and number labels.
All of those need ids with the correct values to pass the tests
Hope that clears it up
To clarify
When I said you can’t have multiple ids in one element I was referring to what you were doing here a few days ago
That is not correct HTML.
You can only have one id per HTML element.
With that said you still need to have and id for the label elements to pass the test
1 Like
Thank you for your help! I passed
system
Closed
July 5, 2024, 12:08pm
14
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.