What's the diff? Why didn't my code work?

My original code:

var main = function() {

Code I found online that work correctly:

var main = function() {

I also found this and it works:

var main = function() {
$('img').click(function() {

Why didn't my code and the others did?

Thank you!!!


Hey again Mark,

I'm glad you appreciate my help & don't mind that I'm the one who responds to like all of your questions, because it's me again :)

As best I can tell, your code is telling the computer:

When the image is clicked, toggle the image using the "dropdown-menu" function.

That doesn't work, because dropdown-menu isn't a function, and even if it were, the quotes would goof it up.
The second bit of code:

When the image is clicked, find it's next sibling, and toggle the sibling.

The third bit of code:

When the image is clicked, find .dropdown-menu and toggle it in a quarter second


Ok I get it. I was not reading things the right way. Thanks again!


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