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 trial

JavaScript JavaScript and the DOM (Retiring) Getting a Handle on the DOM A Simple Example

Daniel McFarlin
Daniel McFarlin
5,168 Points

I got 2 questions

First, can someone please tell me why this code isn't working? I have redone it 3 times now, still not changing of heading color to red when click on. :(

https://w.trhou.se/ffl2g2xnvq

Also does anyone have issues with workspaces randomly indenting when you press enter to go to the next line? and I don't mean like one tap over it indents to like 3/4 across the page to the right...sooooo frustrating when it does that. Is there a setting somewhere in workspaces that I don't know about?

Please help! Thanks friends

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great, but you have a typo which is preventing the code from working as a syntax error is occurring. You have typed

myHeading.addEventListner

But you meant to type:

myHeading.addEventListener

Note the spelling of "Listener". As for the indentation problem, I've run into this once or twice, but generally it's because I haven't properly closed something off in the line before so the editor believes it should do that. As an alternative, you could just type it up in a text editor and paste it in, if you like.

Hope this helps! :sparkles:

Daniel McFarlin
Daniel McFarlin
5,168 Points

Jennifer Nordell, you just may be my favorite person ever for pointing out what I apparently did 3 times while doing this code segment. Thank you SOOOOO much. Also glad to hear it is not just me having issues when it comes to the indention from time to time as well.

Another thing I haven't wrapped my head around in this bit of code is the arrow function. " => " I think I need to do some more research on what exactly that means and what it does.

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Daniel McFarlin about that =>... luckily you don't have to look far! Treehouse has an 8 minute workshop specifically on Arrow Function Syntax. If you've got 8 minutes to spare, you can clear it up pretty quickly :smiley:

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,723 Points

Hey Daniel,

With regards to your first question, you need to change addEventListner to addEventListener. Just missing an 'e'.

As for your second question, I'm afraid I can't help; I don't really have any experience with workspaces. Sorry.

Best,

Clayton

Daniel McFarlin
Daniel McFarlin
5,168 Points

Thank You Clayton! Do you know where I can find some more info explaining the arrow "=>" function though? I don't quite understand that yet.