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

JavaScript

I am struggling with my code: I have the first part correct, I get my navigation to show - but it doesn't hide.

I have the first part correct, I get my navigation to show - but it doesn't hide.

$(".main-nav").hide();


$(".menu-btn-container .menu-toggle").click(function() {
    $(".main-nav").show();
    $(".menu-btn-container").append("<a href='#' class='menu-toggle-off'><span class='menu-icon'><i class='fa fa-times'</i></span></a>");
    $(this).remove();
});

$(".menu-btn-container .menu-toggle-off").click(function() {
    $(".main-nav").hide();
});`

The last part of my code doesnt work. I can't figure out why. Please help

I don't know if this is why, but

<i class='fa fa-times'

is missing the closing

>

.

John Tasto - No that doesn't resolve the problem :(

1 Answer

Have you tried using toggle instead of declaring hide in the last declaration?