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 Perfect

Robert Mews
Robert Mews
11,540 Points

change() vs. select() ?

In looking at the jQuery documentation, I'm confused on why we're using the change() method vs. the select() method to go to the selected page?

1 Answer

Ethan Lowry
PLUS
Ethan Lowry
Courses Plus Student 7,323 Points

change() and select() do very different things. change() is triggered whenever the contents of the element are, well, changed. select() is triggered if you were to example drag your mouse over the text contents within a text input.

Robert Mews
Robert Mews
11,540 Points

That makes sense, Ethan. I'm just learning all the jQuery functions, so I'm quite unsure which ones to use in certain scenarios. Some are more intuitive than others (i.e. .click(), .hover(), etc.)

Ethan Lowry
Ethan Lowry
Courses Plus Student 7,323 Points

Happy to help. To be honest I'd never heard of / used select() before now, I just looked it up in the docs like you, so it's definitely not one you're likely to need very often / ever. change() on the other hand is one of the most frequently used event listeners so it's a good idea to get a good grip on it.