Instead of a link (anchor), use <label>one that is designed for this:
<input type="checkbox" name="favorite_color" id="favorite_color" value="Orange">
<label for="favorite_color">Orange</label>
Or without id, wrapped around him:
<label><input type="checkbox" name="favorite_color" value="Orange"> Orange</label>
Both of them do not require JavaScript, just the built-in behavior of the browser.
source
share