특정 div 내의 링크를 타겟팅하려고합니다. 그래서 같은 모든 링크를 대상으로하는 방법을 이해 :div 내의 모든 링크 대상 - 자바 스크립트
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();
}
물론, 모든 링크를 겨냥한 : http://lexicantest.tumblr.com/
특정 ID/클래스 내의 모든 링크를 대상으로 저를위한 방법이 있나요? ID에 대한
jquery를 사용할 수 있습니까? –
위에서 사용했던 루프를 번역 할 수 있다면 바람직 할 것입니다. –