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

Can someone tell me why onclick is not working?

Hello,

I have checked my code around 4-5 times and I can't see anything wrong with it or maybe I haven't notice it yet.

When I click the buttons they work but in a weird way, not the way it suppose to appear.

Here is my workspace: https://teamtreehouse.com/workspaces/31351262

Thank you.

Steven Parker
Steven Parker
243,253 Points

You can't share a direct URL to your workspace, it's temporary and only exists while you are using it.

But you can use the snapshot function in the workspace and provide the link to that.

5 Answers

Steven Parker
Steven Parker
243,253 Points

Ahh, I see what you mean. In song.js, on line 11, there should be a space inside the quote before the word "class". Otherwise when combined with the tag name, it changes it to "liclass" (not a valid tag name) instead of just adding a class attribute.

There's a similar space missing on line 11 of movie.js.

Oh! my bad.

Thank you for the tutorial. Here it is https://w.trhou.se/4hql3ia2ql

I continued the prototypal inheritance but the problem I think is from the beginning the clicking buttons.

Steven Parker
Steven Parker
243,253 Points

I tried out your workspace and the buttons all seem to work for me.

Perhaps you could explain what you mean by "work in a weird way"?

Yes, sure.

So when the instructor clicks on play you have like a highlight color on the song and then it moves to next one when he clicks next but that doesn't happen here. From the functionality side it works but it doesn't display in the same way as in the tutorial. When I click play the first song decreases the size of the box model for the current song in a really weird way, it shrinks in a really small height and it is centered as well.

I can't believe a space would ruin the whole app appearance!

It is so hard to notice something like that but yes I totally understand what you mean.

Thank you so much for your help :)