In order to make a checkbox checked or radio button selected by default, you need to add the checked attribute to it. There’s no need to set a value to the checked attribute. Instead, just add the word checked to the input element, making sure there is space between it and other attributes.
Make the first radio button and the first checkbox selected by default.
My code
<fieldset>
<legend>Is your cat an indoor or outdoor cat?</legend>
<label><input checked id="indoor" type="radio" name="indoor-outdoor" value="indoor"> Indoor</label>
<label><input checked id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> Outdoor</label>
</fieldset>
I inserted the checked attribute after the first input element but the system still says I am wrong. I placed it after the first input and also after the second but it still marks me as wrong. I am not sure what I can do to fix it. Thank you in advance for your guidance.
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Howdy! I believe that there should be more code, if you could just share that?
From the code you’ve sent, I can see that you’ve added a checked attribute to both your radio buttons. Make it so that only the first radio button has the checked attribute! Also, have the first checkbox in your code have the checked attribute.
Only 2 input elements (one radio and one checkbox) should have the checked attribute.