Is there a way to create a bordered red box around checkboxes that are required but not selected? Here is the code I currently have:
<div class="fb-checkbox-group form-group field-checkbox-group-1500575975893">
<label for="checkbox-group-1500575975893" class="fb-checkbox-group-label">Checkbox Group</label>
<div class="checkbox-group">
<div class="checkbox"><label for="checkbox-group-1500575975893-0"><input name="checkbox-group-1500575975893[]" value="option-1" type="checkbox">Option 1</label></div>
<div class="checkbox"><label for="checkbox-group-1500575975893-1"><input name="checkbox-group-1500575975893[]" value="option-2" type="checkbox">option2</label></div>
<div class="checkbox"><label for="checkbox-group-1500575975893-2"><input name="checkbox-group-1500575975893[]" value="option-3" type="checkbox">option-3</label></div>
</div>
</div>
This snippet is from my stylesheet:
.invalid checkbox-group:required:invalid {
border: 3px solid #900;
}
The current CSS implementation doesn't seem to be working as expected. I am unable to add any additional classes or IDs in the CSS file, and can only use existing ones. The ".invalid" class comes from a typescript file which should display all invalid elements after the user submits the form.
Do you have any suggestions on how to modify the CSS so that the bordered box displays properly?
Here are some references I used: Delay HTML5 :invalid pseudo-class until the first event, Applying border to a checkbox in Chrome.