'for' attribute within label

The instruction say to associate the text Loving with the checkbox by nesting only the text Loving in a label element and giving it an appropriate for attribute.

I’ve tried re-writing it many ways but I don’t understand where I would put the ‘for’ attribute within the label element.

<input id="loving" type="checkbox"><label>Loving</label>

After the name of the element. Just like you put the id attribute on the input element.

What mistake am I making?

<input id="loving" type="checkbox"><label><input for="loving"</label>

You replaced the label text “Loving” with another input element. I don’t think you want to do that.

The for attribute goes on the label element.

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