Build a Survey Form - Build a Survey Form

Tell us what’s happening:

  1. You should have a label element with an id of name-label.

Changing “for” to “id” solved the problem.
Previous lesson showed Name:.
Does this mean “for” isn’t needed anymore and can just be replaced with “id”?

Your code so far

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Survey Form</title>
  </head>

  <body>
    <h1 id="title"> Survey Title</h1>
    <p id="description">Feedback of Title.</p>
    <form id="survey-form">
      <fieldset>
        <legend for="info">Required Info</legend>
        <label for="name-label">Name:</label>
        <input type="text" id="name" required placeholder="E.g. Joe" value="full-name">
        <label id="email-label">Email</label>
        <input type="email" id="email" required placeholder="joe@email.com" value="email">
        <label id="number-label">Fire</label>
        <input type="number" id="number" min="0" max="10" placeholder="E.g. 0">
      </fieldset>
      <fieldset>
        <legend for="dropdown">Shape</legend>
        <select id="dropdown">
          <option >Perfect</option>
          <option >Ok</option>
          <option >Bad</option>
        </select>
      </fieldset>
      <fieldset>
        <legend>Choice</legend>
        <label>Did you have a choice?</label>
        <label for="yes">Yes</label>
        <input type="radio" name="group" value="yes">
        <label for="no">NO</label>
        <input type="radio" name="group" value="no">
      </fieldset>
      <fieldset>
        <legend>Pick</legend>
        <label for="banana">Banana</label>
        <input type="checkbox" id="banana" value="banana">
        <label for="tea">Tea</label>
        <input type="checkbox" id="tea" value="tea">
        <label for="squid">Squid</label>
        <input type="checkbox" id="squid" value="squid">
        <label for="totem">Totem</label>
        <input type="checkbox" id="totem" value="totem">
      </fieldset>
      <label>Feedback?</label>
      <textarea placeholder="Good day" cols="20" rows="5"></textarea>
      <button id="submit">Submit</button>
    </form>
  </body>
</html>

Your browser information:

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

Challenge Information:

Build a Survey Form - Build a Survey Form

no, for and id do different things they are not a replacement of one to the other

the label element needs the for attribute to link to the input element

the id attribute can be used on any element and it is used to uniquely identify an element

your input and label are not linked together, the label needs to have a for attribute with the same value of the id on the input element