[jQuery] how do I get a JQuery object from get() ?
I have the following code:
<div id="columns">
<div id="column1"></div>
<div id="column2"></div>
<div id="column3"></div>
</div>
If I want to find the offset of each of the columns I can do $
('#column1').offset().top for example, which works fine. But I need
to go through the list of columns like this:
for(var i = 0; i < $('#columns > div').length; i++) {
alert($('$columns > div').get(i).offset().top);
}
This doesn't work because get(index) returns an actual DOM element
which doesn't have the offset() function. I would expect both methods
to return the same thing. I don't know why one way I get a JQuery
object and the other way I get a DOM element.
Is there a way to select a list of JQuery Objects instead of a list of
DOM elements?
Thanks,
Kape