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 trialshaun bolak
Front End Web Development Techdegree Graduate 18,080 PointsJavascript DOM scripting - click event listener not firing after refactoring...
Hi all^^
So, after the final refactor of the guest list webpage example showcasing DOM scripting, the event listener on the buttons (remove, edit, save) have ceased to function.
I have spent about an hour comparing my code, line by line, to that of the instructor's and to that of other student examples. There must be a simple error that I am not seeing. However, I am unable to ascertain where and what is the cause.
If someone could take a look, it would greatly help my sanity... ; )
Code Snapshot:
2 Answers
Steven Parker
231,269 PointsIt looks like the button legends don't match the action names (for example: "Edit" with capital "E" vs. "edit" with little "e").
Since JavaScript identifiers are case-sensitive, they have to match exactly for the method invocation using bracket notation on "nameActions" to work.
shaun bolak
Front End Web Development Techdegree Graduate 18,080 PointsHi Steven. You were absolutely right. I went through it again, and that fixed the issue. Really appreciate your time^^
shaun bolak
Front End Web Development Techdegree Graduate 18,080 Pointsshaun bolak
Front End Web Development Techdegree Graduate 18,080 PointsHi Steven. Thank you for your answer. Actually, I tried both case types when I was debugging this (and again, just now, to be sure). It still does function since the refactoring. Is there anything else that you noticed?
Steven Parker
231,269 PointsSteven Parker
231,269 PointsI'm pretty sure that's the issue, you just have to make sure all instances of each name match in the code. There's two for "Remove", and three each for "Edit" and "Save".
Kristina Savova
Full Stack JavaScript Techdegree Graduate 21,997 PointsKristina Savova
Full Stack JavaScript Techdegree Graduate 21,997 PointsHi Steven! I had the same kind of problem. Thank you a lot for your help!
Michael Kristensen
Full Stack JavaScript Techdegree Graduate 26,251 PointsMichael Kristensen
Full Stack JavaScript Techdegree Graduate 26,251 PointsI kind of expected this to happen all the way through this subject, because Gil deliberately didn't write the button-labels with an initial capital, and that didn't seem right to me, visually.