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
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsUncaught SyntaxError: Unexpected token )
NEVER MIND...I figured it out. The closing parenthesis ")" should have been enclosing the bracket "}" and not the other around :)
I am taking the JQuery Basics "Creating a Simple Lightbox". The following is the code in app.js. When viewing the console in my browser (ctrl + shift + j) I keep getting the error:
Uncaught SyntaxError: Unexpected token )
Here is is the code in my app.js:
$("#imagegallery a").click(function(event){
event.preventDefault();
var href = $(this).attr("href");
console.log(href);
)};
It's telling me that the last closing parenthesis ")" is the problem (?) I have checked all open and closed parenthesis but cannot successfully troubleshoot this problem.
Please help. Thanks in advance.
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Carla,
I think you've mismatched the closing curly brace for your function and the closing parenthesis for the click method.
)}; should be });
See if that helps.
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsThanks! Wow! You're good to figure that out so quickly :)
Jason Anello
Courses Plus Student 94,610 PointsYou're welcome. You had a well formed question which helps a lot.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsGlad you figured it out. I hadn't seen your edit yet when I posted.