Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript jQuery Basics (2014) Creating a Mobile Drop Down Menu Perform: Part 1

Cary Oldenkott
Cary Oldenkott
8,178 Points

Drop down menu not showing any text

After following the video step by step, when I go to preview my code, the drop down menu does not show the menu text.

var $select = $("<select></select>"); $("#menu").append($select);

$("menu a").each(function() { var $anchor = $(this); var $option = $("<option></option>"); $option.val($anchor.attr("href")); $option.text($anchor.text()); $select.append($option); });

4 Answers

Cary Oldenkott
Cary Oldenkott
8,178 Points

Sorry, found the problem. I forgot the hashtag on menu on the append method on the second line

Margaret Godowns
Margaret Godowns
6,268 Points

I did the same thing -- glad you caught this!

Thank you, Cary!

Nikola Mitic
Nikola Mitic
9,023 Points

I just spent 45 minutes trying to get my code to work, ahhh hate when this happen. Anyway thanks, have the same miss type as you.

I had my Index page sourcing wrong as last video was working with src="http://code.jquery.com/jquery-1.11.3.min.js" not "src="http://code.jquery.com/jquery-1.11.0.min.js"