The problem here is a conceptual mistake.
To pseudo-class (That’s what it’s called) :active is used to identify one of the four states of a link, that is, if it corresponds to the moment you click on the link. The other pseudoclasses are:link, :visited and :Hover.
What your code does is insert a class in the tag li, which is basically an identifier, such as a id, only it can appear in several elements of the same HTML.
The main difference between the two things, is that the pseudo classes of the links are like state properties of the links, IE, every link will have this without you doing anything, and they can be accessed by CSS for stylization effect.
Of the four, only :Hover and :active can change during the display of a page, so we group link styles into two groups:
a:link, a:visited
a:hover, a:active
The other major difference between classes and pseudoclasses is how they are used in the CSS. The classes (in fact) are symbolized with a point (.), while the pseudoclasses receive two points (:). For example:
a.exemplo:link, a.exemplo:visited { /* estilos */ }
a.exemplo:hover, a.exemplo:active { /* estilos */ }
Here to tag to ("Anchor", or link) is identified by the class .example, and by their respective states (:link and :visited, :Hover and :active)
To try, I suggest the following example:
<!DOCTYPE html>
<html>
<head>
<style>
a:link {color:#009;}
a:visited {color:#090;}
a:hover {color:#900;}
a:active {color:#9f0;}
</style>
</head>
<body>
<p>Passe o mouse e clique aqui: <a href="">link de testes</a></p>
</body>
</html>
Finally, about your code, it should work, but only to dynamically define a class for the li tag, but it will only be used by the CSS style, without any other implication.
Active is not a class, and I don’t think it does what it wants here. Take a look here and click with the mouse on the text: http://jsfiddle.net/X2537/
– Sergio
@Cachuera,
:hover
is an effect when the mouse hovers over a link,:active
is the highlight given to an element when clicked. Both are properties of an element– Papa Charlie