How do I link the input
elements and the label
elements together using the for
attribute, using first-name
, last-name
, email
, and new-password
as values for the respective id
attributes.
Welcome to the forum!
We will need to see the link to the challenge, and all your code for the challenge to see what is going. Please paste the link to the challenge, and when you are entering the code you can use the format button which looks like </>
Mod edit:
Challenge link: https://www.freecodecamp.org/learn/2022/responsive-web-design/learn-html-forms-by-building-a-registration-form/step-18
<!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'>
<fieldset>
<label>Enter Your First Name: <input type="text" for="first-name"/></label>
<label>Enter Your Last Name: <input type="text" for="last-name"/></label>
<label>Enter Your Email: <input type="text" for="email"/></label>
<label>Create a New Password: <input type="text" for="new-password"/></label>
</fieldset>
<fieldset></fieldset>
<fieldset></fieldset>
</form>
</body>
</html>
an id can be used to link things together.
an id is called for using a # before the name.
remember an id is case sensitive.
use the id on the input element.
<input id="text"/>
then add the for attribute to the label using a # before the text.
<label for="#text" ></label>
the link below may provide more help.
I have edited your post to include the link to the challenge
You are still missing the second part of the challenge
" Use first-name
, last-name
, email
, and new-password
as values for the respective id
attributes."
You need to give the inputs the ids that are the same as your for attribute
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.