How to make form element label clickable

Comes handy in checkboxes and radios.

Add the for attribute to the label, and give it a value of the checkbox id.

<input type="checkbox" name="changer" class="link-opener" id="link-opener">
<label for="link-opener">
    Label text
</label>

Or wrap the input and the label text to the label.

<label>
    <input type="checkbox" name="changer" class="link-opener" id="link-opener">
    Label text
</label>

Same goes for all types of input fields.

Comments

Club-Mate, the beverage → club-mate.fi