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

Martin Bornman
PLUS
Martin Bornman
Courses Plus Student 12,662 Points

jQuery

My code is as follows: var $select = $("<select></select>"); $("#menu").append($select); With this done and refresh in browser I dont get that bar as is in the video.Why is that?

Martin Bornman
Martin Bornman
Courses Plus Student 12,662 Points

Thanks Jennifer!!I figure it out.The moment I shrink my browser window,the bar appear.

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

My guess is that you were typing along and thought you'd go back and add the select element later because it is missing from your select variable declaration. You're assigning an empty string to the select variable and then appending it to the document item with the ID of "menu". The end result is that nothing shows. Try this code instead:

var $select = $("<select></select>");
rydavim
rydavim
18,813 Points

I've changed your comment to an answer so that it may be voted on or marked as best answer.