Your sign-up form sends its data, but the words in front of each box are only text that happens to sit nearby. Click Name, and nothing happens. A screen reader reaches the first box and can only announce it as a text box, with no name, so a visitor who can’t see the page has to guess what to type.
In this lesson, you’ll give every field of the sign-up form a label, the HTML element that names a field, and you’ll check each one by clicking its words. Start with the name field.
Tie a Label to Its Field
The browser can’t tell that the word Name belongs to the box after it. As a programmer, you might expect it to infer that from position, but HTML never does. You have to say which text names which field. In events/work-day.html, replace the form’s first paragraph with this one:
<p>
<label for="name">Your name</label>
<input id="name" name="name">
</p>
Two attributes make the tie:
idgives the<input>an identifier that’s unique on the page.foron the<label>holds that sameid, which points the label at its field.
Note that name and id do different jobs, even though both say name here. The name attribute supplies the key for the field’s value when you submit the form. The id is what the label points at.
Save and click the words Your name. The cursor lands in the box, as if you’d clicked the box itself. That click is how you confirm the tie, and it also gives visitors a bigger target to tap on a phone. Screen readers now announce the box as “Your name”.
You can also tie them by putting the field inside its label. Then you don’t need for or id:
<label>Your name <input name="name"></label>
Both ways work the same. This form uses for and id because the label and the field stay separate elements, which makes it easier to place the label above its field later.
Label Every Field
Every field needs the same treatment, including the ones that aren’t there yet. Rosa also wants to know how long each volunteer can stay, which task they’d like, and whether they prefer the morning or the afternoon. Replace the email and phone paragraphs with these two:
<p>
<label for="email">Email</label>
<input id="email" name="email">
</p>
<p>
<label for="phone">Phone (for example, 555 0142)</label>
<input id="phone" name="phone" placeholder="555 0142">
</p>
The placeholder attribute shows faint text inside an empty box. In the phone field, that text is an example of the format Rosa expects. But a placeholder can’t replace a label, because it vanishes as soon as the visitor types, and it is often hard to read. That’s why the format is also in the label, where it stays visible.
Then add the three new fields after the phone paragraph, each with its own label:
<p>
<label for="hours">Hours you can stay</label>
<input id="hours" name="hours">
</p>
<p>
<label for="task">Task</label>
<input id="task" name="task">
</p>
<p>
<label for="slot">Time slot</label>
<input id="slot" name="slot">
</p>
For now, all six fields are plain text boxes, so a volunteer types the hours, the task, and the time slot by hand. In the next lessons, you’ll give the fields controls that fit, such as a number field and a choice of options. Save, and the form shows six labeled fields:

Now test every tie. Click each label in turn, and check that the cursor lands in the box next to it.
If a click on a label does nothing, its for doesn’t match any id, often because of a typo. The browser doesn’t report the mismatch, so the click test is your check.
If the jobs of name and id still blur together, the button below opens a chat with the AI mentor, starting from this question, so you can untangle the key the form sends from the target the label points at:
Check Your Understanding
Before you open the answer, predict what happens in this fragment:
<p>
<label for="day">Preferred day</label>
<input name="day">
</p>
What happens when Ana clicks the words Preferred day, and why?
Nothing. The label’s for="day" points at an id that doesn’t exist, because the input has only a name. Adding id="day" to the input fixes it.
Every field in your form now has a name a visitor can see and a screen reader can announce. In the next lesson, Pick the Right Input Type, you’ll give the email, phone, and hours fields types that bring up the right keyboard on a phone.