Value attribute in radio button and checkbox

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

  **Your code so far**

<!doctype html>
<html>
<body>
<label for="indoor">
<input id="indoor" value="indoor" type="radio" name="indoor-outdoor">Indoor
</label><br>
<label for="outdoor">
<input id="outdoor" value="outdoor" type="radio" name="indoor-outdoor">Outdoor
</label><br>

<label for="loving">
<input  value="loving" type="checkbox" >loving
</label><br>
<label for="lazy">
<input value="lazy" type="checkbox" >lazy
</label><br>
<label for="energetic">
<input  value="energetic" type="checkbox" >energetic
</label>

</body>
</html>  





  **Your browser information:**

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

Challenge: Use the value attribute with Radio Buttons and Checkboxes

Link to the challenge:

Hi @Saumya_29 !

You have changed a lot in the original file that it would best to reset the lesson.

Once you reset the lesson then you can add the value attributes to the checkboxes and radio buttons.

Hello Saumya_29,

Looking at one of your markup for label and input:

The input is not usually a child of label.
The input does not have a closing tag/self-closing tag - they need to be closed.

The “for” attribute in label refers to an element to be linked to via the id.
In this instance if you click on the lable it would look for associated identifier in the “for” attribute - and then check/tick the input checkbox.

Please refer to following links:

Note: all form elements should be wrapped with outer form tag.

Hope that makes sense

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.