I'm trying to add in a bunch of <p<a/a>/p> elements with javascript and wanted to change the active color of a link with javascript. How would I do that? I can't change the color of all hyperlinks with a:active on the css file because I have a set of other links that I want a different color that I'm currently using css to solve.
These are my additions through javascript:
var supertag = document.createElement("p");
var tag = document.createElement('a');
var text = document.createTextNode("Join a New Community!");
tag.appendChild(text);
tag.href = "http://localhost:8088/communities_index/communities_index.html";
tag.style.color = "blue";
supertag.appendChild(tag);
var element = document.getElementById("globalCommunities");
element.appendChild(tag);
I can change the hyperlink's color to blue but then it loses its active color which would've been red to css. The other links are black which then turn blue on hover and red on active. I'd like the new hyperlink to be blue and turn red when active.