Miva Merchant Modules and Development
Want to start an online store? We work with you from start to finish, from commerce platform to design to SEO.
Experience counts, and we have a lot.

FORMS: Checkbox Check by Click on Text

Scot Ranney • August 15, 2024


Clicking on the text next to a checkbox should always check the box, but if you can't use FOR in the label tag to point to the checkbox input ID, there is a simple hack to get around this. Simply put everything you inside the label tag, including the input. 

In these example, clicking on the text, images, etc, will cause the checkbox to be checked.

<label>
	Click me to check the box. <input type="checkbox">
</label>


<label>
	<input type="checkbox">
	Click me or this image <img src="image.png"> to check the box.
</label>

Etc.


https://www.scotsscripts.com/mvblog/forms-checkbox-check-by-click-on-text.html

mvkb_checkbox mvkb_input