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 trialFalk Schwiefert
8,706 PointsUnexpected token } and I am blind
I have started working on my first project and it was working until I expanded it.
This is the (mainly JQuery) code:
var runeGeneration = function() {
$overlay.empty();
$("section").append($overlay);
$overlay.append($pseudo);
for (i = 0; i < 3; i++) {
imageGeneration();
}
$overlay.append($closeOverlay);
$closeOverlay.click(function(){
$overlay.hide();
});
$('img.rune').click(function(){
$("section").append($descriptionBox);
$.get('/descriptions/ansur.txt', function(data) {
$(descriptionBox).html(data);
}, 'text');
});
}
The piece that I just added is this
$.get('/descriptions/ansur.txt', function(data) {
$(descriptionBox).html(data);
}, 'text');
});
It was working until now and suddenly it throws an error but I can't find where it comes from. Although, to be honest I have been staring at code the last 5 hours and that might have something to do with it.
Thank you for looking at it.
2 Answers
jobbol
Full Stack JavaScript Techdegree Student 17,885 Points- Ran it through jsbeautifier. All parenthesis and brackets match up.
- Thought
$.get
would throw an error, but that's funky jQuery shorthand. - Did you mean...
/*this*/ $(descriptionBox).html(data);
/*or this*/ $descriptionBox.html(data);
- Finally are you sure the bracket error is in this section of your code?
- Provide more code if you get to this point.
Falk Schwiefert
8,706 PointsThank you for your answer Josh. I can't provide more code as I have already thrown the whole thing out and rewritten it. :)
jobbol
Full Stack JavaScript Techdegree Student 17,885 PointsAh, I know that feeling. Rewrite the entire thing because you can no longer trust it. Sorry I couldn't be of more assistance. Good luck out there. :/