I'm trying to target links within a certain div. I understand how to target all the links, like so:
var colors = [ 'BlueViolet', 'CadetBlue', 'Coral', 'Crimson', 'DarkGoldenRod', 'DarkOliveGreen'],
a = document.getElementsByTagName('a');
for(var i = 0; i < a.length; i++) {
var elem = a[i],
color = colors[0];
elem.style.color = color;
colors.push(color);
colors.shift();
}
Obviously, it's targeting all links: http://lexicantest.tumblr.com/
Is there a way for me to target all the links within a certain id/class?