$(this).hasClass('something') returns a boolean value.
Q: Is there a list of which methods return non jQuery objects?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.