I want to a user to be able to hover over a link, click it, and it will automatically check the checkbox to the left of it, and when they select it, it will uncheck the box.
How do I do this?
<input type="checkbox" name="favorite_color" value="Orange"> <a href="#" rel="favorite_color">Orange</a>
Instead of a link (anchor), use a
<label>which is designed for this:Or without the
id, wrapped around it:With both of these there’s no JavaScript required, just built-in browser behavior.