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