curriculum/challenges/english/blocks/learn-html-forms-by-building-a-registration-form/62ff8b9dab5ac88e4d3d43a3.md
Following accessibility best practices, link the input elements and the label elements together using the for attribute.
Use first-name, last-name, email, and new-password as values for the respective id attributes.
The first input element should have an id of first-name.
assert(document.querySelectorAll('input')?.[0]?.matches('#first-name'))
The second input element should have an id of last-name.
assert(document.querySelectorAll('input')?.[1]?.matches('#last-name'))
The third input element should have an id of email.
assert(document.querySelectorAll('input')?.[2]?.matches('#email'))
The fourth input element should have an id of new-password.
assert(document.querySelectorAll('input')?.[3]?.matches('#new-password'))
The first label element should have a for attribute with a value of first-name.
assert(document.querySelectorAll('label')?.[0]?.matches('label[for="first-name"]'))
The second label element should have a for attribute with a value of last-name.
assert(document.querySelectorAll('label')?.[1]?.matches('label[for="last-name"]'))
The third label element should have a for attribute with a value of email.
assert(document.querySelectorAll('label')?.[2]?.matches('label[for="email"]'))
The fourth label element should have a for attribute with a value of new-password.
assert(document.querySelectorAll('label')?.[3]?.matches('label[for="new-password"]'))
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Registration Form</h1>
<p>Please fill out this form with the required information</p>
<form method="post" action='https://register-demo.freecodecamp.org'>
--fcc-editable-region--
<fieldset>
<label>Enter Your First Name: <input /></label>
<label>Enter Your Last Name: <input /></label>
<label>Enter Your Email: <input /></label>
<label>Create a New Password: <input /></label>
</fieldset>
--fcc-editable-region--
<fieldset></fieldset>
<fieldset></fieldset>
</form>
</body>
</html>
body {
width: 100%;
height: 100vh;
margin: 0;
background-color: #1b1b32;
color: #f5f6f7;
}
label {
display: block;
margin: 0.5rem 0;
}