How can I pass a parameter to a jquery iterator function (or whatever they're called), like:
var states = new Array();
states.push(true);
$(children).each(function(states) {
if(this.depth>states.length)
{
states.push(this.collapsed);
}
else if (this.depth<states.length)
{
states.pop();
}
var collapsed=states[states.length-1];
}
);
The "states" parameter arrives either as an int or a boolean, never an array. Suggestions? I'd prefer not to declare states as global. (The code above resides inside of a method).