Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development Building Out WordPress Navigation The wp_nav_menu Function

I corrected the foundation.min.js, Console reads: Uncaught TypeError: undefined is not a function, app.js?ver=4.0.1:1

I corrected the foundation.min.js and clicked the menu icon. The console reads: Uncaught TypeError: undefined is not a function, app.js?ver=4.0.1:1.

The red x won't happen. I hope that this is an easy one. I checked the theme files and my functions.php and app.js look to be ok.

please help. thanks.

I am getting this too. I've done as Ryan suggested and amended the app.js file so it is coded like this:

(function($) {

$( ".nav-toggle" ).click(function() {
$(this).toggleClass("open");
$("nav").fadeToggle(100);

  return false;
});

}) (jQuery);

When I click on the menu button still nothing happens. The console shows this:

GET http://nikkomsgchannel/e?001900560059005200410047006a0054002c00570059005000…5a005d0059005b0062005000580045005b000d00580058005f005f005a0059002d005a005b VM2158:63 rapport_nikko_send_focus_eventVM2158:73 rapport_nikko_on_focus VM2158:50 GET http://nikkomsgchannel/e?001900560059005200410047006a0054002c00570059005000…5a005c005b00280010005100580044005d000b005f005d005f005e0058002a005f005b005b VM2158:50 rapport_nikko_on_blur

Any ideas on how to fix please?

1 Answer

I'm going to take a guess and assume that you're dealing with WordPress' noConflict rule. As you know, jQuery runs using the $ object, but WordPress removes that object to avoid conflicts with other JavaScript libraries. You can still access it through the jQuery object; the $ variable and jQuery variable are one and the same.

What I usually do is make an anonymous function that is immediately called and then passed jQuery under the $ alias. In simpler words, try wrapping your JavaScript with this code:

(function($) {

  // your code here

})(jQuery);

Thank you! Great explanation. I must have missed that step.