for...in loop
for...in loop
I am just trying to figure out how to do some different things with the for...in loop and jQuery, but now I'm wondering if this is even possible. I made a simple example to test:
function tellMeHeights() {
var allDivs = $.makeArray('div')
for (mydiv in allDivs)
{
height = $(mydiv).css('height')
alert(height)
}
}
But this doesn't work - the alert box just says 'undefined'. Is it possible to iterate jQuery objects like this, or should I be using something else like .each?
Thanks for the help