My code works correctly, but isn't being accepted


#1


My code:


$(document).ready(function(){
    $('div').click(function(){
    $('div').toggleClass('highlighted');
    });   
});


My error:
"Oops, try again. Did you replace your .addClass() with a .toggleClass()?"

I opened a support ticket almost a week ago now, and they replied asking me for more details, so I sent a screen shot of the issue, and then they closed the ticket and asked how my experience with support was... lol.
Um, not good haha.


#2

@wynx I have a question what part of modifying html elements are you on


#3

I have one more question can I see your support ticket number please thank you @wynx


#4

Part 7: toggling classes.I do exactly what I am instructed, and the error given clearly restates what I am to do, which you can see by my code I have already done.


#5

Have you looked at the example code at the top of the page before the instructions


#6

yes, did you see my code I posted? It is not only the same but also it works. And it's the same as the suggestion that is given when I submit and an error is thrown.


#7

Hey wynx, just a quick suggestion:
for your first 'div' it should be #text since they only wanted it done for the second box.
Also, for your second 'div' it should just be 'text' without any ' ' or just the word 'this' without any ' '.
Actually the only way to get this exercise to work was using 'this' without the ' '.


#8

Adding the #text as a selector for the event worked. Thank you!
Funny thing though, I left the first div as ('div') and the second div as ('#text') so I guess it didn't really matter how I did it so long as only that div was selected.
'#text' -> this looks nicer though.


#9

Thank you @mileswilde for helping @wynx I was too busy. Have a great day wynx and mileswilde.


#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.