Can't Check Radio Buttons and Checkboxes by Default00001

I cant check Radio Buttons and Checkboxes by Default while Using the value attribute with Radio Buttons and Checkboxes

This is not enough information to help you. Is this a project you are working on? If so then you need to provide us a link to it so we can test it for ourselves. If this is concerning something else then you need to give us all the details so we can see what you are talking about.

1 Like

Check Radio Buttons and Checkboxes by DefaultPassed

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

3 Likes

What have you tried? What does your code look like? What part isn’t working correctly?

1 Like

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

I can’t check Radio Buttons and Checkboxes by Default while Using the value attribute with Radio Buttons and Checkboxes

  **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://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>

<p>Things cats love:</p>
<ul>
Check Radio Buttons and Checkboxes by DefaultPassedCheck Radio Buttons and Checkboxes by DefaultPassed  <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="https://www.freecatphotoapp.com/submit-cat-photo">
  <label for="indoor"><input id="indoor" type="radio" name="indoor-outdoor" checked> value="indoor"> Indoor</label>
  <label for="outdoor"><input id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> Outdoor</label><br>
  <label for="loving"><input id="loving" type="checkbox" name="personality" checked>value="loving"> Loving</label>
  <label for="lazy"><input id="lazy" type="checkbox" name="personality" value="lazy"> Lazy</label>
  <label for="energetic"><input id="energetic" type="checkbox" name="personality" value="energetic"> Energetic</label><br>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>
</main>
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36

Challenge: Check Radio Buttons and Checkboxes by Default

Link to the challenge:

I have merged your duplicate topics.

1 Like

still i didn’t get any solution

Your question was asked in two threads. I combined them into a single thread so that you are more likely to get useful help.

1 Like

just type checked keyword at the end of input element

Please use meaningful titles rather than just jamming random numbers into the topic title. Thanks.

1 Like

Please actually interact with the people trying to help you instead of just quoting some random portion of a previous post. Thanks.

1 Like

It looks like you malformed your input elements. The syntax highlighting here is trying to show you where. There is something screwy going on after the attribute checked in your elements.

1 Like

i copy/pasted your code , it passes for me.
i think you should reset the topic and try again.
if it still doesn’t work try different browser.

1 Like

Yes u get me here. I know how to pass the problem …I have to remove

value=“indoor”>

this, but I need it to stay,what’s the way to keep it in my code then

Hmm, that code shouldn’t pass given the malformed syntax.


You certainly should not remove that. That part is needed.


Well, what part of the code I highlighed is not valid? Why do you have two >?

1 Like

it does not matter for this challenge as after you close input element everything after that has nothing to do with <input> as it was close before value="indoor">
this is not causing the problem.

<label>
<input type="radio" value="etc" > everything after that is a text even  > this its valid but is a  typing error
</label>
1 Like