Build a Checkout Page - Build a Checkout Page

Tell us what’s happening:

Hi everyone, I’m definitely missing something. Can’t pass.
10. All of your input elements that aren’t a type of submit should have a label element associated with them.
Please help

Your code so far

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

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

<body>
    <h1>Checkout</h1>
    <section>
        <img src="https://cdn.freecodecamp.org/curriculum/labs/cube.jpg" alt="Rubic cube"/>
        <p>Rubic Cube</p>
        <p>$10.99</p>
       <h2>Your Cart</h2> 
    </section>
    
    <section>
        <h2>Payment Information</h2>
        <form method="POST" action="#">
        <fieldset>
          <legend>Credit/Debit card</legend>
          <label for="card-name">Name on the card (required):</label>
          <input aria-required="true"
          
          type="text" 
          id="card-name" 
          name="card-name" 
          placeholder="Ex. John Doe" 
          required size="20"
          required=""
          />
         
          <p></p>
          <label for="card-number">Card number:(required)</label>
          <input aria-required="true"
            
            id="card-number"
            type=" number"
            name="card-number"
            size="16"
            required=""
          />
          <p></p>
          <label for="exp-month">Month: (required)</label>
          <input aria-required="true"

          type="number" 
          name="exp-month" 
          id="exp-month"
           min="1" 
           max="12" 
           required=""
           />

          <label for="card-year">Year:(required)</label>
          <input aria-required="true"
          
          type="number" 
          name="card-year" 
          id="expiration" 
          min="22" 
          max="35"
          required="" 
          />

          <p></p>
          <label for="card-cvv">CVV number:(required)</label>
          <input
            
            id="card-cvv"
            type=" number"
            name="card-cvv"
            size="3"
            required=""
            />
            <p></p>
            <button type="submit">Submit</button>
        </fieldset>

        
    </form>

    </section>
    

</body>

</html>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36

Challenge Information:

Build a Checkout Page - Build a Checkout Page

review if they are correctly associated.

1 Like

I got it, thank you very much

1 Like

How do you associate a label to an input element ?

I got it
id should be the same with for attribute

Thank you very much

1 Like