110
rated 0 times
[
117]
[
7]
/ answers: 1 / hits: 22958
/ 12 Years ago, thu, march 22, 2012, 12:00:00
I want to iterate over all childs of a jQuery's .children()
return value, like this:
var childs = $element.children();
for (var i = 1; i < childs.length - 1; i++)
childs__.foo();
What do I have to write in the 3 line instead of __
, to access the i-th child?
I want this becaus I want to access the (i-1)-th and (i+1)-th child in the loop, like this:
var childs = $element.children();
for (var i = 1; i < childs.length - 1; i++)
{
childs<<i>>.css('height', childs<<i - 1>>.height());
childs<<i>>.css('width', childs<<i + 1>>.width());
}
So I assume the each()
function will not work.
More From » jquery