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 Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Perform: Traversing Elements with querySelector

Eliot Murton
Eliot Murton
7,315 Points

"Uncaught SyntaxError: Unexpected token ("

Hi. I am following the instructions for the Deep Dive titled "Interactive Web Pages With JavaScript" and as far as I can tell I have exactly the same code as the video dictates, yet I am getting "Uncaught Syntax Error: Unexpected token (".

Can anybody recommend the best site for me to paste my code so it can be checked and I can be told where the issue is? (I was going to paste it in here but I think the code is too long for it to let me)

1 Answer

Erik McClintock
Erik McClintock
45,783 Points

Eliot,

You can check out JSLint to validate your JavaScript.

This error you're getting though is indicative of some erroneous syntax; check the line if the error gives one, otherwise pour over your code and read it very carefully, making sure that you're closing every set of parenthesis and brackets, that you have all necessarily commas and semi-colons, equals signs, etc. It's very easy to make these mistakes, and very tricky (initially) to hunt down the culprit, but it is doable and you'll get better at it with practice.

Erik