Yes, but ‘name-label’ is not ‘name’
So I need to add another id to the input name with value name?
You can only have one id for an HTML element. You must use the id that the instructions told you to use.
Все очень запутанно, если мы указываем имя в id, то в метке также указывается имя, а потом ошибка говорит, что имя должно быть указано в метке и как это понять?
You need to use an id of name-label
for the label and an id of name
for the name input.
Please post actual code instead of pictures of your code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1 id="title">Форма опроса freeCodeCamp</h1>
<p id="description">Благодарим вас за то, что нашли время помочь нам улучшить платформу</p>
<form id="survey-form">
<fildset>
<label for="name">Name<input id="name" name="name" type="text" placeholder="Enter your name" required></label>
<label for="email">Email<input id="email" name="email" type="email" placeholder="Enter your Email" required></label>
<label for="number">Age
(optional)<input id="number" name="number" type="number" min="3" max="10" placeholder="Age" required ></label>
<label for="dropdown">Which option best describes your current role?
<select id="dropdown">
<option>Select current role</option>
<option>Student</option>
<option>Full Time Job</option>
<option>Full Time Learner</option>
<option>Prefer not to say</option>
<option>Other</option>
</select>
</label>
</fildset>
<fieldset>
<label>Would you recommend freeCodeCamp to a friend?
<label><input type="radio" name="count2">Definitely</label>
<label><input type="radio" name="count2">Maybe</label>
<label><input type="radio" name="count2">Not sure</label>
</label>
</fieldset>
<fieldset>
<label>What is your favorite feature of freeCodeCamp?
<select>
<option value="">Select an option</option>
<option value="1">Challenges</option>
<option value="2">Projects</option>
<option value="3">Community</option>
<option value="4">Open Source</option>
</select>
</label>
</fieldset>
<fieldset>
<label>What would you like to see improved? (Check all that apply)
<label><input type="checkbox">
Front-end Projects</label>
<label><input type="checkbox">
Back-end Projects</label>
<label><input type="checkbox">Data Visualization</label>
<label><input type="checkbox"></label>
<label><input type="checkbox">ChallengesOpen Source Community</label>
<label><input type="checkbox">
Gitter help rooms</label>
<label><input type="checkbox">Videos</label>
<label><input type="checkbox">City Meetups</label>
<label><input type="checkbox">Wiki</label>
<label><input type="checkbox">Forum</label>
<label><input type="checkbox">Additional Courses</label>
</label>
</fieldset>
<fieldset>
<label for="text">Any comments or suggestions?
<textarea id="text" name="text" row="3" cols="30" placeholder="Enter your comment here..."></textarea>
</label>
</fieldset>
<input type="submit" value="Submit">
</form>
</body>
</html>
This element doesn’t have the required id
I already did but it still doesn’t work
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1 id="title">Форма опроса freeCodeCamp</h1>
<p id="description">Благодарим вас за то, что нашли время помочь нам улучшить платформу</p>
<form id="survey-form">
<fildset>
<label for="name-label">Name<input id="name" name="name" type="text" placeholder="Enter your name" required></label>
<label for="email-label">Email<input id="email" name="email" type="email" placeholder="Enter your Email" required></label>
<label for="number-label">Age
(optional)<input id="number" name="number" type="number" min="3" max="10" placeholder="Age" required ></label>
<label for="dropdown">Which option best describes your current role?
<select id="dropdown">
<option>Select current role</option>
<option>Student</option>
<option>Full Time Job</option>
<option>Full Time Learner</option>
<option>Prefer not to say</option>
<option>Other</option>
</select>
</label>
</fildset>
<fieldset>
<label>Would you recommend freeCodeCamp to a friend?
<label><input type="radio" name="count2">Definitely</label>
<label><input type="radio" name="count2">Maybe</label>
<label><input type="radio" name="count2">Not sure</label>
</label>
</fieldset>
<fieldset>
<label>What is your favorite feature of freeCodeCamp?
<select>
<option value="">Select an option</option>
<option value="1">Challenges</option>
<option value="2">Projects</option>
<option value="3">Community</option>
<option value="4">Open Source</option>
</select>
</label>
</fieldset>
<fieldset>
<label>What would you like to see improved? (Check all that apply)
<label><input type="checkbox">
Front-end Projects</label>
<label><input type="checkbox">
Back-end Projects</label>
<label><input type="checkbox">Data Visualization</label>
<label><input type="checkbox"></label>
<label><input type="checkbox">ChallengesOpen Source Community</label>
<label><input type="checkbox">
Gitter help rooms</label>
<label><input type="checkbox">Videos</label>
<label><input type="checkbox">City Meetups</label>
<label><input type="checkbox">Wiki</label>
<label><input type="checkbox">Forum</label>
<label><input type="checkbox">Additional Courses</label>
</label>
</fieldset>
<fieldset>
<label for="text">Any comments or suggestions?
<textarea id="text" name="text" row="3" cols="30" placeholder="Enter your comment here..."></textarea>
</label>
</fieldset>
<input type="submit" value="Submit">
</form>
</body>
</html>
Where is the id
for this element? I don’t see it.
Also, you have a for
attribute for this element, but it will not work correctly, as that for
does not correspond to the id
of the input element.
So if there should be only one id in the input, then I cannot add the second id or can I?
The input must have one id
. It must be the id
you are told to use.
The label must have one id
. It must be the id
you are told to use.
If your label has a for
attribute, that attribute must correspond to the id
of the input.
Of course I can’t figure it out, so my code doesn’t work again.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1 id="title">Форма опроса freeCodeCamp</h1>
<p id="description">Благодарим вас за то, что нашли время помочь нам улучшить платформу</p>
<form id="survey-form">
<fildset>
<label for="name-label">Name<input id="name" id="name-label" name="name" type="text" placeholder="Enter your name" required></label>
<label for="email-label">Email<input id="email" id="email-label" name="email" type="email" placeholder="Enter your Email" required></label>
<label for="number-label">Age
(optional)<input id="number" name="number" id="number-label" type="number" min="3" max="10" placeholder="Age" required ></label>
<label for="dropdown">Which option best describes your current role?
<select id="dropdown">
<option>Select current role</option>
<option>Student</option>
<option>Full Time Job</option>
<option>Full Time Learner</option>
<option>Prefer not to say</option>
<option>Other</option>
</select>
</label>
</fildset>
<fieldset>
<label>Would you recommend freeCodeCamp to a friend?
<label><input type="radio" name="count2">Definitely</label>
<label><input type="radio" name="count2">Maybe</label>
<label><input type="radio" name="count2">Not sure</label>
</label>
</fieldset>
<fieldset>
<label>What is your favorite feature of freeCodeCamp?
<select>
<option value="">Select an option</option>
<option value="1">Challenges</option>
<option value="2">Projects</option>
<option value="3">Community</option>
<option value="4">Open Source</option>
</select>
</label>
</fieldset>
<fieldset>
<label>What would you like to see improved? (Check all that apply)
<label><input type="checkbox">
Front-end Projects</label>
<label><input type="checkbox">
Back-end Projects</label>
<label><input type="checkbox">Data Visualization</label>
<label><input type="checkbox"></label>
<label><input type="checkbox">ChallengesOpen Source Community</label>
<label><input type="checkbox">
Gitter help rooms</label>
<label><input type="checkbox">Videos</label>
<label><input type="checkbox">City Meetups</label>
<label><input type="checkbox">Wiki</label>
<label><input type="checkbox">Forum</label>
<label><input type="checkbox">Additional Courses</label>
</label>
</fieldset>
<fieldset>
<label for="text">Any comments or suggestions?
<textarea id="text" name="text" row="3" cols="30" placeholder="Enter your comment here..."></textarea>
</label>
</fieldset>
<input type="submit" value="Submit">
</form>
</body>
</html>
You stil have no id
attribute here.
You have added two id
attributes to the same HTML element again. You cannot do that.
Do you know what an input
element is?
Do you know what a label
element is?
Do you know what the id
attribute is and how to set it equal to a value?
Expanding on this:
Your input
element must have an id
attribute, set equal to the value you are required to use.
Your label
element must have an id
attribute, set equal to the value you are required to use.
For example, if I wanted someone to enter their favorite color, I might have this:
<label for="favorite-color">Favorite Color
<input
id="favorite-color"
name="favorite-color"
type="text"
placeholder="Enter your favorite color"
>
</label>
Don’t worry about the spacing - that’s just to make it easier to read.
The input
has an id
. (Things can only have one id
and that id
can’t be used anywhere else on the site.) The label
has a for
attribute that tells it what id
to look for, to know to what it is associated.
Я так понял, что на входе должен быть один id, но вы говорите, что нужно создать некую фору, так где ее создавать?
I don’t know what you mean by “create some kind of handicap”.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1 id="title">Форма опроса freeCodeCamp</h1>
<p id="description">Благодарим вас за то, что нашли время помочь нам улучшить платформу</p>
<form id="survey-form">
<fildset>
<label for="name-label">Name<input id="name" name="name" type="text" placeholder="Enter your name" required></label>
<label for="email-label">Email<input id="email" name="email" type="email" placeholder="Enter your Email" required></label>
<label for="number-label">Age
(optional)<input id="number" name="number" type="number" min="3" max="10" placeholder="Age" required ></label>
<label for="dropdown">Which option best describes your current role?
<select id="dropdown">
<option>Select current role</option>
<option>Student</option>
<option>Full Time Job</option>
<option>Full Time Learner</option>
<option>Prefer not to say</option>
<option>Other</option>
</select>
</label>
</fildset>
<fieldset>
<label>Would you recommend freeCodeCamp to a friend?
<label><input type="radio" name="count2">Definitely</label>
<label><input type="radio" name="count2">Maybe</label>
<label><input type="radio" name="count2">Not sure</label>
</label>
</fieldset>
<fieldset>
<label>What is your favorite feature of freeCodeCamp?
<select>
<option value="">Select an option</option>
<option value="1">Challenges</option>
<option value="2">Projects</option>
<option value="3">Community</option>
<option value="4">Open Source</option>
</select>
</label>
</fieldset>
<fieldset>
<label>What would you like to see improved? (Check all that apply)
<label><input type="checkbox">
Front-end Projects</label>
<label><input type="checkbox">
Back-end Projects</label>
<label><input type="checkbox">Data Visualization</label>
<label><input type="checkbox"></label>
<label><input type="checkbox">ChallengesOpen Source Community</label>
<label><input type="checkbox">
Gitter help rooms</label>
<label><input type="checkbox">Videos</label>
<label><input type="checkbox">City Meetups</label>
<label><input type="checkbox">Wiki</label>
<label><input type="checkbox">Forum</label>
<label><input type="checkbox">Additional Courses</label>
</label>
</fieldset>
<fieldset>
<label for="text">Any comments or suggestions?
<textarea id="text" name="text" row="3" cols="30" placeholder="Enter your comment here..."></textarea>
</label>
</fieldset>
<input type="submit" value="Submit">
</form>
</body>
</html>
here again the code is already with one id but nothing works,
Do you see this code right here that I keep quoting? This label
element needs an id
attribute. Can you see which element I am talking about?
Also, that for
attribute needs to match the id
attribute of the input
.
<label for="name-label" id="name">Name<input id="name" name="name" type="text" placeholder="Enter your name" required></label>?
Yes, that is some code. Do you have a question about that code?
This is not the id
the instructions told you to use.
Also,