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 trialTim Brooks
2,339 PointsDOM selection: can't get heading to turn red
I think I've followed directions in the tutorial exactly, but get no color change from
const myHeading = document.GetElementById('myHeading');
myHeading.addEventListener('click', () => {
myHeading.style.color = 'yellow';
});
Here's my snapshot. If it says yellow, that's because I'm a bit colorblind.
3 Answers
Rabin Gharti Magar
Front End Web Development Techdegree Graduate 20,928 PointsHey Tim Brooks,
Looks like you have capitalized
letter g
whilst selecting myHeading
.
const myHeading = document.getElementById('myHeading');
Hope this helps!
Tim Brooks
2,339 Pointsah, thank you both. I see it now
Doak Covington
4,644 PointsA helpful tool to using for these types of lessons is https://codepen.io/
It gives you a better picture of whats going on then workspaces.
Doak Covington
4,644 PointsHi Tim,
You need to camel case GetElementById
Tim Brooks
2,339 PointsLooks to me like I did already
Tim Brooks
2,339 PointsTim Brooks
2,339 PointsLink to snapshot: const myHeading = document.GetElementById('myHeading');
myHeading.addEventListener('click', () => { myHeading.style.color = 'yellow';
});
https://w.trhou.se/conkaqzvhr