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 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"