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 Using change()

Jamie Bradley
Jamie Bradley
7,148 Points

jQuery: Dropdown menu

"Modify the $button click code so it now performs the redirect when the $select is changed." This is the code I used, which is clearly wrong :( What am I missing, please?

$button.click(function(){ window.location=$select.change(function.val(); });

3 Answers

Jacob Miller
Jacob Miller
12,466 Points

They want the redirect to happen when $select is changed, so you need to replace $button.click( with $select.change(.

$select.change(function(){
  window.location = $select.val();
});

says Task one is no longer passing

says Task one is no longer passing

Took me a few to minutes but I got past the Error on Task 1 problem.

  1. First remove the code on line 27 entirely

2.Change line 29 to this $select.change(function(){

If this does not work please respond with the error and your code so I can see what may be the problem

Lee Miller
Lee Miller
5,266 Points

to solve the problem of task one no longer passes, you must remove the line you changed in Task one