HTML and HTML5: Use the value attribute with Radio Buttons and Checkboxes

Tell us what’s happening:

When a form gets submitted, the data is sent to the server and includes entries for the options selected. Inputs of type radio and checkbox report their values from the value attribute.

For example:

<label for="indoor"> 
  <input id="indoor" value="indoor" type="radio" name="indoor-outdoor">Indoor 
<label for="outdoor"> 
  <input id="outdoor" value="outdoor" type="radio" name="indoor-outdoor">Outdoor 

Here, you have two radio inputs. When the user submits the form with the indoor option selected, the form data will include the line: indoor-outdoor=indoor . This is from the name and value attributes of the “indoor” input.

If you omit the value attribute, the submitted form data uses the default value, which is on . In this scenario, if the user clicked the “indoor” option and submitted the form, the resulting form data would be indoor-outdoor=on , which is not useful. So the value attribute needs to be set to something to identify the option.

Give each of the radio and checkbox inputs the value attribute. Use the input label text, in lowercase, as the value for the attribute.

Your code so far

<p>Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="" alt="A cute orange cat lying on its back."></a>

<p>Things cats love:</p>
  <li>cat nip</li>
  <li>laser pointers</li>
<p>Top 3 things cats hate:</p>
  <li>flea treatment</li>
  <li>other cats</li>
<form action="/submit-cat-photo">
  <label><input type="radio" name="indoor-outdoor"> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
  <label><input type="checkbox" name="personality"> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label><br>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Mobile/15E148 Safari/604.1.

Challenge: Use the value attribute with Radio Buttons and Checkboxes

Link to the challenge:

It looks like you just copied the lesson text. Do you have a question?

I need help with exactly what it’s asking me to do.

What part is confusing you?

Knowing where to add the attributes. I know you add it to the code that I already have implemented. Where inside of the code do I add it?

Attributes go into the opening tag of an HTML element. In the example code, the input elements have several attributes (id, value, etc).