Phillip Senn
Phillip Senn

Reputation: 47625

Which methods return jQuery objects?

$(this).hasClass('something') returns a boolean value.

Q: Is there a list of which methods return non jQuery objects?

Upvotes: 0

Views: 81

Answers (2)

spender
spender

Reputation: 120480

Yes, the jQuery API reference should provide this info.

Upvotes: 3

SLaks
SLaks

Reputation: 887469

When you call a method, you call it for a reason.

If you called the method to find something out (eg, hasClass, is, index, filter, etc), it will return that value.
If you called the method to do something (eg, animate, load, append, etc), it will return the original jQuery object.

Note that "property" methods (eg, val, html, css, width, etc) will fall into different categories depending on how you call them.

For more details, check the documentation.

Upvotes: 4

Related Questions