3

Possible Duplicate:
How do I access style properties of pseudo-elements with jQuery?
Manipulating CSS :before and :after pseudo-elements using jQuery

I'm making an on/off switch and decided to try using the :after pseudo-element for the physical switch. The styling is such that I just need to switch the pseudo element between float right and float left to switch it on and off.

Can I select pseudo-elements in jQuery or plain javascript? I've tried $("#myid:after") and $("#myid::after"), both of which work in the stylesheet but are not working as jQuery selectors.

Or do I have to give in and use an extra div or span? That seems like it would be a pretty big drawback for pseudo elements.

Community
  • 1
  • 1
danny
  • 10,103
  • 10
  • 50
  • 57

0 Answers0