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 jQuery Basics (2014) Creating a Mobile Drop Down Menu Perform: Part 3

Zachary grace
Zachary grace
6,682 Points

Why isn't it working in workspace?

I'm following the videos exactly in workspace for "creating a mobile drop down menu" in jquery, and when I go to view the progress so far, the drop down menu I'm creating isn't showing up. Any body having the same issue?

Ken Alger
Ken Alger
Treehouse Teacher

Zachary:

I just worked my way through that badge and didn't have any issues. Can you post the code you have?

Ken

Zachary grace
Zachary grace
6,682 Points

//Problem: It look gross in smaller browser widths and small devices //Solution: To hide the text links and swap them out with a more appropriate navigation

//Create a select and append to #menu var $select = $("<select></select>"); $("#menu").append($select);

//Cycle over menu links $("#menu a").each(function(){ var $anchor = $(this); //Create an option var $option = $("<option></option>");

//Deal with selected options depending on current page if($anchor.parent().hasClass("selected")) { $option.prop("selected", true); } //option's value is the href $option.val($anchor.attr("href")); //option's text is the text of link $option.text($anchor.text()); //append option to select $select.append($option); }):

//Bind change listener to select $select.change(function(){ //Go to select's location window.location = $select.val(); }); //Modify CSS to hide links on small width and show button and select //Also hides select and button on larger width and show's links

Zachary grace
Zachary grace
6,682 Points

http://jsfiddle.net/3a36Y/

This might be easier to check it out in.

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Zachary;

You have a colon at the end of the "//append option to select line" of code instead of a semi-colon.

 $select.append($option); }):

should be

$select.append($option); });
Zachary grace
Zachary grace
6,682 Points

Thank you. Those minor details can make it or break it.