I am using javascript to change the color of the text of a tag by mouseover function on other tag written in html. ex:
function mouseoverbox1() {
var mypara = document.getElementById("a1");
mypara.style.color = "green";
}
<div onmouseover="mouseoverbox1()">
<a id="a1">Color</a>
<a id="a1">Names</a>
<a id="a1">Places</a>
</div>
Now as I run the code only the color of tag "Color" changes to green and not of Names and Places. Is there any way that my function could accept the changes to all anchor tags with similar id???
getElementsByAttribute( "id", "a1")instead ofgetElementById.