Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

How to make text of an html checkbox clickable (like ASP.NET control)

0.00/5 (No votes)
29 Jun 2011 1  
Make text of an html checkbox clickable (like ASP.NET control)
If you put a label HTML tag after the checkbox (either HTML check box or Server Side checkbox control), and set the ID of the check box to the "for" attribute of the label tag, clicking the text in the label tag will click the checkbox:

The code will be as below:
<input type="checkbox" id="checkbox1"/>                                                             

<label for="checkbox1">
 label text
</label>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here