I'm trying to have different styles for whether a user has typed something into a text field or not. There doesn't seem to be a pseudo-class (like :hover or :focus) for this, but honestly, I'm not even sure how to google for it. I was thinking I could use an @if but im also not sure how to go about that. Any help would be great.
1 Answer
You can't do that with Sass (as cimmanon said), it's only a superset for css; you can only create rules for some pseudo-classes / cases.
You can validate fields with JavaScript or server-side languages - there are tons of plugins for almost any JS frameworks, and for vanilla JS also.
Just one example: https://github.com/posabsolute/jQuery-Validation-Engine
:requiredor:invalid.