Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAmy Tomey
12,847 Pointswhy don't i get the same result on my console?
on my console... it looks like this: (so I get a list, but not the items on the list.)
document.querySelectorAll('li') NodeList(7) [li, li.error-not-purple, li, li, li.error-not-purple, li.error-not-purple, li] 0: li 1: li.error-not-purple 2: li 3: li 4: li.error-not-purple 5: li.error-not-purple 6: li length: 7 proto: NodeList
document.querySelectorAll('.error-not-purple') NodeList(3) [li.error-not-purple, li.error-not-purple, li.error-not-purple] 0: li.error-not-purple 1: li.error-not-purple 2: li.error-not-purple length: 3 proto: NodeList
just wondering why my console output id different from Guil's?
here is my js: const myList = document.getElementsByTagName("li");
for (let i = 0; i < myList.length; i += 1){ myList[i].style.color = 'purple'; }
const errorNotPurple = document.getElementsByClassName("error-not-purple");
for (let i = 0; i < errorNotPurple.length; i += 1){ errorNotPurple[i].style.color = 'red'; }