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 trialSpencer Renfro
Courses Plus Student 11,133 PointsWhy am I getting a violation error inside the console?
I get this violation message to appear when I run my code.
jquery.js:3 [Violation] Added synchronous DOM mutation listener to a 'DOMNodeInserted' event. Consider using MutationObserver to make the page more responsive.
Here is my code: const answer = prompt('Which planet is closest to the sun?');
if (answer.toUpperCase() === 'MERCURY') { console.log("That's correct!") } else { console.log("Sorry, that's not correct.")
}
4 Answers
Steven Parker
231,275 PointsOdd, I can't replicate the problem and this error message seems to come from "jQuery"; but that's not used in this code (and I don't think it's used anywhere in this entire course). If you're using a workspace, make a snapshot of your workspace and post the link to it here to allow a more accurate analysis.
if you're doing this in a different environment, see if you accidentally configured it to use jQuery.
Spencer Renfro
Courses Plus Student 11,133 PointsIt runs the first time then I refresh and run it and that code pops up, but thank you for your input on this!
Steven Parker
231,275 PointsI tried multiple refreshes and still no error. But as I said, since the project doesn't use jQuery it's not even a possible error you could get from this project.
Sunny Purdin
5,232 PointsI am having the same problem. This is the error I am getting "Uncaught SyntaxError: Unexpected token ';' conditionals.js:4 "
Steven Parker
231,275 PointsThat's a very different problem. You should start a fresh question and post a snapshot of your own workspace in it.
Sunny Purdin
5,232 PointsI did finally get it to work. I had to take the semicolons out for some reason and it worked.
Steven Parker
231,275 PointsYou could still create a new question and post the original code if you'd like to understand what was happening.
Spencer Renfro
Courses Plus Student 11,133 PointsSpencer Renfro
Courses Plus Student 11,133 PointsI used this in the treehouse environment only and used the development tools for mac (command option j) here is my link: https://w.trhou.se/n1ffpq5k4n
Steven Parker
231,275 PointsSteven Parker
231,275 PointsI forked the snapshot, opened the preview, and it ran fine. I checked the entire project to confirm that there is no reference to jQuery, so I'm totally baffled by the message you are seeing.