Glitch In the Codecademy API?


#1

Hello zystvan,

I'm having the same issue as julienk403, except I believe my code is correct.. dare I say it, I think it's a glitch in the codecademy api.

Here's my code:

$(document).ready(main);

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

Do I have something wrong?


Interactive website: #3-Dropdown Menu exercise
#2

@rorygrenade You need to call main() after it's declared. E.g.,

var main = function() {
  // ...
}

$(document).ready(main);

#3

Thanks brother.

The exercise does seem a bit misleading since this is the code you start of with:

$(document).ready(main);

var main = function () {

};

Nevertheless, thanks again for your assistance.


#4

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