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.

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,650 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!