You can find the following interesting article.
In essence, the object (jQuery) returned by the jQuery function $()has a bunch of properties that include one for each element that matches the selector, with the property name being a numeric "index"
For example, given the following HTML
<p>Hello, World!</p>
<p>I'm feeling fine today</p>
<p>How are you?</p>
and selector
$('p');
the returned object will look like this
({length:3, 0:{}, 1:{}, 2:{}})
Using the command .get(), you can access the corresponding elements and work with them accordingly. Following the lead
$(function () {
var p = $('p').get();
for (var prop in p)
alert(prop + ' ' + p[prop].innerHTML);
});
, , ,
$(function () {
var p = $('p');
for (var i=0; i< p.length; i++)
alert(i + ' ' + p[i].innerHTML);
});
0 Hello, World!
1 I'm feeling fine today
2 How are you?
, , , , jQuery.
, , ,
, Tomas Lycken. , -, ,
var mySimpleArray = ['a','b','c'];
, "" "". , "" , ,
var myObjectArray = [{ index: 5, name: 'a' },{ index: 22, name: 'b'},{ index: 55, name: 'c'}];