Understanding the jQuery Object returned from a jQuery Selector Query
Cody Lindley has a great post that explains some of the innards of the jQuery object returned from selector queries. As you may know if you are using jQuery, the jQuery object returned from a jQuery selector expression is an object that acts like an array, but is in fact an object with numeric properties that masquerade as an array. If this sounds a little confusing you’re not alone. Even though I had figured this out some time ago, every time I talk about jQuery I seem to get my terminology mixed up calling it the jQuery object and jQuery array interchangeably <snicker>... which is not correct – it’s definitely an object.
Anyway, check out Cody’s Post on the Learning jQuery site which explains in some detail how the jQuery object is constructed and how it is that you can treat an object like an array which is effectively a neat hack that might be useful to you in other JavaScript situations.
BTW the Learning jQuery site is a good site to keep bookmarked and RSS hooked since they frequently cover interesting content that explains some of the inner workings of jQuery… highly recommended.
Other Posts you might also like
- Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application
- Resolving Paths To Server Relative Paths in .NET Code
- Map Physical Paths with an HttpContext.MapPath() Extension Method in ASP.NET
- Back to Basics: Rewriting a URL in ASP.NET Core
- Getting the Client IP Address in ASP.NET Core
The Voices of Reason
# re: Understanding the jQuery Object returned from a jQuery Selector Query
Actually the only place I saw 'wrapped set' mentioned as such is in jQuery in Action and I've taken to using that myself because it clearly says what the object does. Still it's basically an object instance and that's what I was referring to when I said the jQuery object.
# re: Understanding the jQuery Object returned from a jQuery Selector Query
http://codeclimber.net.nz/archive/2008/04/11/Beware-the-.-in-jQuery-elementId--document.getElementByIdelementId.aspx
# re: Understanding the jQuery Object returned from a jQuery Selector Query
# re: Understanding the jQuery Object returned from a jQuery Selector Query
# re: Understanding the jQuery Object returned from a jQuery Selector Query
http://www.learningjquery.com/2008/12/peeling-away-the-jquery-wrapper
# re: Understanding the jQuery Object returned from a jQuery Selector Query
Just a semantic note, I think what you are referring to is actually known as the jquery wrapped element set. (the jQuery object actually being the main beast that you add utility methods,etc to)