Ideally, I would like the label text to change color when the input value is invalid.
Example:
<form>
<label>
Enter an email address:
<input type="email">
</label>
</form>
Ideally, I would use something like this, but it does not work because it is the <input>
that's invalid, not the <label>
:
label:invalid {
color: red
}
I have my <label>
and <input>
set up this way so that I don't need to pass in id
's into these elements.
Similar to this, however the <label>
and <input>
are not siblings: https://pretagteam.com/question/change-the-colour-of-a-label-when-an-input-is-invalid