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 jQuery Basics Understanding jQuery Events and DOM Traversal What is Traversal?

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

What is traversal?

So what is the final solution to this problem ?
I understood what you are saying about the breaking of code when we want to add another element between the spoiler tags and spoiler buttons . So I am trying to find out the actual solution to this problem.
Can anyone help me ?

1 Answer

Colton Ehrman
Colton Ehrman
255 Points

In the video the answer seems to be $(event.target).prev().show() instead of $('spoiler span').show()

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

But in the last video , she said "This is good for small projects , but its will be problamatic in bigger projects". When you try to enter new elements between the "button" and "p" , then the final code will fail.

Colton Ehrman
Colton Ehrman
255 Points

Yes, it is a low-quality solution I guess you could say. I would suggest coming up with a better one on your own, it will help you become a better programmer.