This is the answer: Setting CSS pseudo-class rules from JavaScript
The problem with this answer is that it's completely useless. I'd go so far as to say wrong. To me, the answer says "no, what you want to do isn't possible, here's some irrelevant documentation". When in fact, it is possible - just read the next three answers.
It was wrong the minute it was written, and it's been sitting around as the accepted answer for close to four years now, on a question with a not too shabby 12.5k views.
The user who asked the question hasn't been seen since he accepted the answer, so it's not like he's going to come back and change his mind.
I tried flagging the answer approximately six months ago:
Please consider deleting (or unaccepting) this answer. It simply does not answer the question, and everyone reading this question in the future would be better off if Bobince's answer was first.
The flag was declined, but there was a reason given:
declined - [..] it doesn't look off-topic enough to be outright removed, and I can't unaccept it either, sorry about that
This Meta question is highly relevant: Blatantly wrong accepted answer
Reading that question makes me wary to post this question, but I'm doing it anyway.
Can something be done?