Previously, I’ve learned to create checkbox with
id in Basic HTML and HTML5: Create a Set of Checkboxes.
Now, I’m doing Responsive Web Design Projects - Build a Survey Form. I saw User Story #14, it says
each of which must have a
So now I have noticed there are 2 ways to create checkbox.
Solution 1: create checkbox with
<label for="loving"> <input type="checkbox" name="personality" id="loving"> Loving </label>
Solution 2: create checkbox with
<label> <input type="checkbox" name="personality" value="loving"> Loving </label>
Question: What is the difference between “Solution 1” and “Solution 2”? Do they work the same?