I have a variable that contains html code.
var link = "<li><a href="#"></a></li>";
I want to color my element a which is repeat n times. So I did :
document.getElementsByTagName("a").addClass("selected")
And in my css I defined
.selected{ color: red; }
But it seems to not work. Nothing changed in the html.