Learn HTML Forms by Building a Registration Form - Step 18

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

/* file: index.Ext.html */
<!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 id="first-name"><label for> <input id="first-name" /></input></label>
        <label>Enter Your Last Name: <input id="last-name"><label for> <input id="last-name" /></input></label>
        <label>Enter Your Email: <input id="email"><label for> <input id="email" /></input></label>
        <label>Create a New Password: <input id="new-password"><label for> <input id="new-password" /></input></label>
      </fieldset>
      <fieldset></fieldset>
      <fieldset></fieldset>
    </form>
  </body>
</html>
/* file: styles.Ext.css */
<!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 id="first-name"><label for> <input id="first-name" /></input></label>
        <label>Enter Your Last Name: <input id="last-name"><label for> <input id="last-name" /></input></label>
        <label>Enter Your Email: <input id="email"><label for> <input id="email" /></input></label>
        <label>Create a New Password: <input id="new-password"><label for> <input id="new-password" /></input></label>
      </fieldset>
      <fieldset></fieldset>
      <fieldset></fieldset>
    </form>
  </body>
</html>

Your mobile information:

M2101K6G - Android 13 - Android SDK 33

Challenge: Learn HTML Forms by Building a Registration Form - Step 18

Link to the challenge:

The second input element should have an id of last-name.

What am I doing wrong?

As you see here that your input element has the attribute of id=“first-name”:

You want link your ‘label’ element to the input element so that when the user clicks on the question they will get directed to the matching input field. Instead off adding this after your input element:

Just give your ‘label’ elements opening tag the attribute of ‘for’ with a value matching to your inputs elements id.
Ex:

<label for="one">First question <input id="one"/></label>

As you can see, you don’t have to double any off your elements just add the appropriate ‘for’ attribute to your opening label element and ‘id’ attribute to your input element.
Do this for all of your input/label elements.
Hope this helps.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.