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 trialDaniele Manca
Courses Plus Student 7,548 PointsPerfect Mobile Dropdown challenge
Not sure I understand the code challenge, given that in the perfect video the .change(); method is shown, I thought I would have to apply that onto the challenge, something like below:
$button.change(function(){ //Go to select's location window.location = $select.val(); });
However does not really seem to be what the challenge asks, can someone help please?
2 Answers
Guy Noda-Bailey
18,837 PointsThe button no longer exists because in the previous challenge we deleted the code that appends the button;
$("#menu").append($button); //we deleted this append
So instead of binding the .change event to the button, we want it to call the function when the $select element has been changed;
$select.change(function(){
//Go to select's location
window.location = $select.val();
});
// This way, as soon as a user selects an option from
// the $select element the function runs and sends the
// browser to the page they selected. This eliminates
// the need for the end user to make an extra click
// on the "Go" button.
Guy Noda-Bailey
18,837 PointsNo worries. The forums are great aren't they.
Daniele Manca
Courses Plus Student 7,548 PointsYep they are! :)
Daniele Manca
Courses Plus Student 7,548 PointsDaniele Manca
Courses Plus Student 7,548 PointsAmazing Guy,
Thanks for your help, you cleared up my doubt!
:)