0

I have seen it on several webpages (cannot recall where exactly atm) where I am able to check or uncheck checkboxes by clicking on the text in front of the checkbox. I know how to do it in JavaScript (create a span with onclick()) , but I want to know if there is any way I can do it without JavaScript.

Kalu Singh Rao
  • 1,671
  • 1
  • 16
  • 21
Youstay Igo
  • 321
  • 2
  • 11
  • 1
    You are looking for the [`label`](https://developer.mozilla.org/en/docs/Web/HTML/Element/label) tag. – Boaz Aug 01 '16 at 05:57
  • 2
    See http://stackoverflow.com/questions/6293588/how-to-create-an-html-checkbox-with-a-clickable-label – Stéphane Aug 01 '16 at 05:57

1 Answers1

5

You can achieve this functionality using label tag as given below.

<input type="checkbox" id="option">

<label for="option">Select this option</label>
niyasc
  • 4,440
  • 1
  • 23
  • 50