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
Shaun Moore
6,301 PointsJavascript Error
I am getting this error,
Uncaught SyntaxError: Unexpected token (
With this code
<div onclick = "function() { document.getElementById(view_button).removeAttribute(content_overlay); }"
id="view_button" >
View <?php echo $heading_title ?>
</div>
Shaun Moore
6,301 PointsNope I have started my own project
1 Answer
Jacob Mishkin
23,118 Pointsyou have a space after the equals sign, that might cause the token error. A lot of the time a token error can be caused by a empty character space, also Check these links out:
http://www.smashingmagazine.com/2008/09/jquery-examples-and-best-practices/
https://en.wikipedia.org/wiki/Unobtrusive_JavaScript
writing obtrusive JS is considered bad practice. I would not suggest coding like this, as it causes problems.
What line is the error on? The line of the JS or PHP?
Caleb Kleveter
Treehouse Moderator 37,862 PointsCaleb Kleveter
Treehouse Moderator 37,862 PointsIs there a challenge you are doing?