Forms: a school admission form फ़ॉर्म: स्कूल एडमिशन फ़ॉर्म
Lesson 5 of 14 · about 18 minutes · Collect information with inputs, labels, dropdowns and buttons.
⚡ 0 XP
Step 1 of 2
Inputs and labels
A <form> holds the fields people fill in. The most common field is <input> — it has no closing tag. Its type changes what it accepts:
type="text" — any text, like a name
type="email" — an email address
type="date" — shows a date picker
type="number", type="tel" — numbers and phone numbers
Every input needs a <label>. Connect them: the label’s for must match the input’s id. Then clicking the label focuses the box, and screen readers read the label aloud.
`for="student"` matches `id="student"` — that is the connection.
🎯 Challenge: Start the admission form +20 XP
Inside the <form>, after the name field, add:
a parent’s email field (type="email")
a date of birth field (type="date")
Give every input a <label> whose for matches the input’s id.
Try twice to unlock the solution (0/2)
index.htmlCtrl ⏎
Preview
Console
Output from console.log appears here.
Checklist
Press Run to check your code.
○
There is an email input in the form
○
There is a date input in the form
○
Every input has a matching label
Lesson notes (text version)
1. Inputs and labels
A <form> holds the fields people fill in. The most common field is <input> — it has no closing tag. Its type changes what it accepts:
type="text" — any text, like a name
type="email" — an email address
type="date" — shows a date picker
type="number", type="tel" — numbers and phone numbers
Every input needs a <label>. Connect them: the label’s for must match the input’s id. Then clicking the label focuses the box, and screen readers read the label aloud.