Build a Checkout Page - Issues with P Element and Card Number Input

Tell us what’s happening:

I’m getting 2 errors. One is that I should have a p element with an id attribute of “card-number-help” immediately after the card number input element. The second is that my card number input should have an aria-describedby attribute set to “card-number-help” To me, it looks as though I’ve done this correctly and ChatGPT couldn’t find the issue either. I tried to copy and paste the card-number-help text directly from the instructions and that didn’t work either.

Your code so far

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <title>Checkout Page</title>
</head>

<body>
  <h1>Checkout</h1>
  <section>
      <h2>Your Cart</h2>
      <img src="https://cdn.freecodecamp.org/curriculum/labs/cube.jpg" alt="rubix cube twisted in different directions" />
  </section>
  <section>
      <h2>Payment Information</h2>
      <form>
          <label id="card-name" name="card-name" type="text" for="card-name">Name
            <span aria-hidden="true">*</span>
          </label>
          <input id="card-name" name="card-name" type="text" required />
          <label id="card-number" name="card-number" type="text" for="card-number">Card Number
            <span aria-hidden="true">*</span>
          </label>
           <input id="card-number" name="card-number" type="text" required aria-describedby="card-number-help"/>
           <p id="card-number-help">Enter the card number as 0000-0000-0000-0000</p>
      </form>
  </section>
</body>

</html>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0

Challenge Information:

Build a Checkout Page - Build a Checkout Page

Welcome to the forum @kathrynchill

Review how you associate label and input elements.

Happy coding

oh my gosh - thank you!! I guess I overthought the label elements - I removed all attributes except for the for attribute for my card-number label specifically and it worked!

1 Like