Pseudo elements like :hover and parent selectors
Hi folks,
you'll probably know that there's no such thing as a parent selctor in CSS, so I used to use jQuery for this.
To select all li elements that has an a element inside of them this would be
- $("li:has(a)").css("property", "value");
(I read that beneath the :has selector there's a .has() filter that does the same and is quicker but never tried that).
The solution above doesn't work when I try to target psuedo-elements of that selectors.
What I want to achieve is selecting all hovered li that contain an active a:
- $("li:hover:has(a:active)").css("property", "value");
which gives me the error message.
"Exception: Syntax error, unrecognized expression: unsupported pseudo: hover"
So I tried with the .has()-method:
- $("li:hover").has("a:active").css("property", "value");
That code does just nothing, no error, no effect.
Any ideas how to achive what I am trying to do?