How to replicate this logic?

Hi guys, How do I replicate the logic shown in the screenshot in CSS? Basically, I want to check if the input is selected. If it is, then select the parent div
3 Replies
WillsterJohnson
WillsterJohnson•3y ago
You're probably looking for :has(), https://developer.mozilla.org/en-US/docs/Web/CSS/:has though be aware that this isn't supported in FireFox yet. Currently, if you want-cross browser support you're gonna need to use JavaScript. The bug tracker for :has() in FireFox has it's bug tracker here https://bugzilla.mozilla.org/show_bug.cgi?id=418039, other browsers instated this as stable a few months ago, so expect FireFox to catch up pretty soon
Jochem
Jochem•3y ago
you can enable it in firefox using a config setting, so I can't imagine it'll take too long... but if it has to work everywhere now, it's too early to use :has
son arg
son argOP•3y ago
Thanks guys! 🙂
Want results from more Discord servers?
Add your server