Forms commonly use <code>checkboxes</code> for questions that may have more than one answer.
Checkboxes are a type of <code>input</code>
Each of your checkboxes can be nested within its own <code>label</code> element. By wrapping an <code>input</code> element inside of a <code>label</code> element it will automatically associate the checkbox input with the label element surrounding it.
All related checkbox inputs should have the same <code>name</code> attribute.
It is considered best practice to explicitly define the relationship between a checkbox <code>input</code> and its corresponding <code>label</code> by setting the <code>for</code> attribute on the <code>label</code> element to match the <code>id</code> attribute of the associated <code>input</code> element.
Add to your form a set of three checkboxes. Each checkbox should be nested within its own <code>label</code> element. All three should share the <code>name</code> attribute of <code>personality</code>.
- text: Your page should have three checkbox elements.
testString: 'assert($(''input[type="checkbox"]'').length > 2, ''Your page should have three checkbox elements.'');'
- text: Each of your three checkbox elements should be nested in its own <code>label</code> element.
testString: 'assert($(''label > input[type="checkbox"]:only-child'').length > 2, ''Each of your three checkbox elements should be nested in its own <code>label</code> element.'');'
- text: Make sure each of your <code>label</code> elements has a closing tag.
testString: 'assert(code.match(/<\/label>/g) && code.match(/<label/g)&&code.match(/<\/label>/g).length === code.match(/<label/g).length,''Makesureeachofyour<code>label</code> elements has a closing tag.'');'
- text: Give your checkboxes the <code>name</code> attribute of <code>personality</code>.
testString: 'assert($(''label > input[type="checkbox"]'').filter("[name=''personality'']").length > 2, ''Give your checkboxes the <code>name</code> attribute of <code>personality</code>.'');'