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 2

Ashton Morlote
Ashton Morlote
5,517 Points

jQuery drop down menu script is not running

I do not know why my script isn't running...

Once I figure out how to post a picture of my code I will.

//Problem: It looks bad in smaller browser width
//solution: To hide the text links and swap them out with better nav

//create a select and append to #menuvar 
var $select = $("<select></select>");

//cycle over menu links
$("#menu a").each(function(){
  var $anchor = $(this);

  //create an option
  var $option = $("<option></option>");

  //option's value is the href
  //option's text is the text of link
  //append option to select
//create button 
var $button = $("<button>Go</button>");
//bind click to button
  //Go to select's location
  window.location = $select.val();

//modify css to hide links on small resolution and show button
//also hides select and button on larger width
//deal with selected options depending on current page

Can you post a snapshot of your workspace? http://www.teamtreehouse.com/forum/workspace-snapshots

Ashton Morlote
Ashton Morlote
5,517 Points

Nevermind. It started working now. there must have been a glitch or something in the workspace.

Thank you Marcus Parsons for showing me how to share a snapshot though! very much appreciated.

Oh okay awesome! You're welcome, Ashton. They are neat aren't they? :P