7. Toggling Class not accepting my answer


$(document).ready(function() {
$('div#text').click(function() {

I don't understand what I am doing wrong. Toggle is also working, but not allowing me to pass next level.


I've solved the problem. I've removed 'div' section.

$(document).ready(function() {
$('#text').click(function() {


Thanks for posting this. I had a similar problem and you answered it for me.


This section seemed so easy too. Change one word is all it says- and it doesn't work. Thanks for figuring this out for us.


But why did changing $('div#text') to $('#text') work? I would think that they both would select the same element since there's only one div with an id of text. It's weird that just changing .addClass to .toggleClass didn't work


Seems like the answer checker is looking for a very specific piece of code: $("#text").toggleClass("highlighted")

I defined a variable to hold $("#text") and it wouldn't accept my answer despite it functioning properly. There's nothing wrong with your answer, it's just that the answer checker is looking for one particular solution (I think).