Survey Form - Build a Survey Form

Okay this is where I am stuck
" 1. For the name, email, and number input fields, you can see corresponding label elements in the form, that describe the purpose of each field with the following ids: id="name-label", id="email-label", and id="number-label""

If I try to change the content of my ids on these lines it messes up previous code. I am not sure but I would assume you can’t have 2 ids in the same element? I don’t quite understand this step. Can someone try to help clarify pretty please?

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Survey Form</title>
  </head>
  <body>
    <h1 id="title">Survey Form</h1>
    <p id="description">How Are We Doing?</p>
    <form id="survey-form">
      <fieldset>
        <label for="name">Enter Your Full Name<input id="name" name="name" type="text" required /></label>
        <label for="email">Enter Your Email<input id="email" name="email" type="email" required/></label>
        <label for="number">Age(optional)<input id="number" name="age" type="number" min="13" max="120"/><label>
    </form>
    </body>
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

Challenge: Survey Form - Build a Survey Form

Link to the challenge:

The last ‘label’ closing tag doesn’t have a forward slash in front of the element’s name:

....</label>

The closing ‘fieldset’ tag is also missing.

This means that you should add an id attribute inside the label element (in addition to the for attribute that you already have).

Thankyou for catching that, however, that was not what I am currently struggling with.

Okay, that is what I was thinking. I just was also thinking it would be weird to have 2 different ids in the same element. I will try this pronto. I’m the queen of making things harder than they need to be.

okay the id went into the label element rather than putting it into the input that was nested in the label element. Lightbulb just turned on… Thanks!!!

1 Like

yes you definitely don’t want 2 ids. A for attribute is obviously not an id attribute.
The reason for adding the id attribute to the label is only so that the test can check your work.
You may not need to ever do this in real life code.