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

HTML jQuery Basics (2014) Creating a Mobile Drop Down Menu Using change()

Mark Lovett
Mark Lovett
15,853 Points

resize() worked too

//bind change listener to the select $select.resize(function() { window.location = $select.val(); });

resize() , instead of change(), seemed to work well, also surprisingly even $button.resize(function() { worked too.

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Mark,

I assume you're working with select boxes which shouldn't respond to a resize event as that event is only delegated for when the page changes it's size overall. anytime you're working with a select box and you need to watch for a value change the onchange event on in jQuery's case the change event should be bound.

While this may of worked when it shouldn't have you might find in other browsers it doesn't behave the same way.

Mark Lovett
Mark Lovett
15,853 Points

That's good to know. Thanks very much Chris!