I have this HTML fragment:
<div class="form-group">
<div class="col-sm-1"></div>
<label for="allquestion4" class="col-sm-6 control-label label-red">Question</label>
<div class="col-sm-1"></div>
<div class="col-sm-3">
<select size="2" class="selectpicker" id="allquestion4" title="Choose">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</div>
<div class="col-sm-1"></div>
</div>
Why is the label not being found by the following jQuery:
$(this).closest('label').hasClass('.label-red');
Where $(this) is the select picker.
UPDATE
Try this fiddle.