Displaying content when checkbox is checked
What is the best way to display additional content when only the first of a series of checkboxes is checked. For example, the form below includes four checkboxes. When the first is checked, a question with a textarea field needs to appear.
- <div class="checkbox">
- <label><input name="answer" id="answer1" type="checkbox" value="Answer 1">Answer 1</label>
- </div>
- <div id="whyContainer" class="form-group hidden">
- <div>
- <label class="control-label" for="expertise">Why?</label>
- </div>
- <textarea class="form-control" cols="40" id="why" name="why" rows="10"></textarea>
- </div>
- <div class="checkbox">
- <label><input name="answer" id="answer2" type="checkbox" value="Answer 2">Answer 2</label>
- </div>
- <div class="checkbox">
- <label><input name="answer" id="answer3" type="checkbox" value="Answer 3">Answer 3</label>
- </div>
- <div class="checkbox">
- <label><input name="answer" id="answer4" type="checkbox" value="Answer 4">Answer 4</label>
- </div>