Wondering whether if there is a css-only way to perform to toggle styles on the corresponding label on input\'s focus. So far I have:
$(
It's possible with CSS only, without switching the order of the label and input. You can use a :focus-within
CSS pseudo-class on the parent element, which applies to elements, that has a child element with the focus.
In your example, you could use the following:
.row:focus-within label {
color: red;
}
Note, that this pseudo-class is relatively new, so only modern browsers support it.