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