I am new at coding

Tell us what’s happening:
can someone give me the answer to this

Your code so far


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

<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>

<p>Things cats love:</p>
<ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
  <li>flea treatment</li>
  <li>thunder</li>
  <li>other cats</li>
</ol>
<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="loving" value="indoor"> loving</label>
<label><input type="checkbox" name="lazy" value="outdoor"> lazy</label>
<label><input type="checkbox" name="energetic" value="indoor"> energetic</label><br>

  <input type="text" placeholder="cat photo URL" required><br>
  
  <button type="submit">Submit</button>
</form>
</main>

Your browser information:

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

Challenge: Use the value attribute with Radio Buttons and Checkboxes

Link to the challenge:

Take a look at your code again. You successfully assigned a value attribute to your checkbox items, but what value did you assign? Is that the correct value that the tests call for?

You still need a value attribute on your radio items.

Click here to Learn more about value attribute. FreeCodeCamp is really a good source to learn coding from but you shouldn’t just rely on one resource. Google it, watch more tutorials on youtube and try to understand it from various angles. One way of explanation may not suit your style like another might. That’s why the seemingly short course is also said to take 300 hours to complete. Dig deeper for each topic and take your time.

Another helpful link to learn from codecademy. You can practice from both websites (I don’t go for the paid version in codecademy though) for an edge. And you can look for details in Mozilla Developer Network too, if you want deeper thing.

can you explain in more detail of what you mean?

Hello @trevinoivan486 ,

Check the code to the left of the lesson : that’s the answer. :smiley: :smiley:

type="checkbox" name="loving" value="indoor"

Look at your value attribute. You’ve set it to "indoor".
If you look at the test conditions on the bottom left of the screen, you can see what it should be.

yes, but it says " One of your radio buttons should have the value attribute of indoor" so does that mean its right or is something else wrong

<label><input type="radio" name="indoor-outdoor">
<label><input type="radio" name="indoor-outdoor">
These are your radio buttons. You have not set a value attribute on them yet.

so do i set the value as “outdoor”

You have two <radio> buttons, and the test conditions tell you what to set the value attribute to for each of them.
You have three <checkbox> elements, and the test conditions tell you what to set the value to for each of those as well.

i thought i did it right but it rejected everything
sorry i am new at this and i am very confused

You changed the type attribute on your radio buttons.
You changed the name attribute on your checkboxes.

I recommend clicking the reset all code option to return the challenge to its default setting. Then try adding the value attributes again.

ok i reset it so now i just add in the value attributes where?

Just like you did before. You add the value attribute within the <input> tag; just don’t change any of the other attributes this time. :slight_smile:

1 Like

ok so i did it but it still told me the same thing and i havent changed any other attributes

Remove the < before “value”.

oh my gosh thank you! crazy how one thing is important. i am sorry for wasting a lot of your time just i am new to all this and you just really helped me understand more.

I am glad you got it! And I am always willing to help! It is a lot to learn all at once, and we are all prone to making very tiny mistakes that end up shutting down the entire code. :slight_smile:

:+1:t4: :grinning: thank you so much