[ACCEPTED]-What is a jQuery Object?-definitions
A jQuery object is array-like which means 13 that it contains zero or more indexes (properties 12 which names are positive integers starting 11 with zero). Besides those indexes, a jQuery 10 object contains these properties:
length
context
selector
And also 9 around 140 inherited methods (which are 8 defined on the jQuery.prototype
object - you can do console.dir(jQuery.prototype)
to 7 get a full list... ).
Note that jQuery objects 6 do not contain (or inherit) the Array methods 5 (slice, substr, ...). If you want to execute 4 those methods on your jQuery object, use 3 call
/apply
.
For example, if you have 3 TEXTAREA elements 2 on the page and you do this:
var j = $('textarea');
then this j
jQuery 1 object will contain these properties:
0
- reference to the first TEXTAREA element1
- reference to the second TEXTAREA element2
- reference to the third TEXTAREA elementlength
- which is3
context
- reference to thedocument
objectselector
- which is'textarea'
- plus all those inherited methods...
the jQuery object is an object which has 7
- a length property
- numeric properties which reference the items from the select (0,1,2,3...)
- bindings to jQuery functions
- additional jQuery properties
The length and numeric properties allow 6 the object to respond like an array. You 5 can run it in a for
loop or use functions like 4 map
or each
on it.
I would recommend using your 3 browser's debugger or Firebug and inspect 2 a jQuery object. That will teach you a 1 lot about how it is structured.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.