Interactive website: #3-Dropdown Menu exercise


#1

Hello,
Having a little trouble getting started here. Any help/fresh set of eyes greatly appreciated.

Here's what's needed:
Use jQuery to select the More link. This involves the 'dropdown-toggle' class. Add a .click() with a function inside. This function is called a click event handler.

Inside the event handler:
a. Use jQuery to select the 'dropdown-menu' class.
b. Then make the menu show and disappear using .toggle().

Here's my code:

var main = function() {
$('.dropdown-toggle').click(function() {
$('.dropdown-menu').toggle();
});
}

Here's the error message I get: Oops, try again.
It looks like the dropdown menu isn't showing after clicking on More
navigation element. Remember to toggle the dropdown menu inside the
event handler.

Any ideas?


#2

Hi Julienk403,

I think you forgot to call main once the page has loaded. Do you know how to do that?

Hint

You can do that with this:

$(document).ready(function);

In this case, you would substitute function for main :)


#3

Thanks! This worked. I didn't know you didn't need to add 'main' there.


#4

3 posts were split to a new topic: Glitch In the Codecademy API?


#7

3 posts were split to a new topic: I Can't Find the Issue With My Code


#10

2 posts were split to a new topic: Could Someone Help Me With My Code?


#11

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