[jQuery] how do iterate through array of JQery objects
I'm having problems iterating through an array of JQuery objects.
Here's my code:
var x = $("#skip a");
for (var i=0;i<a.length;i++){
var n = x[i];
$(n).click(function(){
$(n.hash).hide();
$("#primary h1").after( $(n.hash)[0] );
$(n.hash).fadeIn("slow");
return false;
});
}
x=$("skip a) is an array of links which have named anchors for their
href. I want each link to not jump to the named anchor, but to
dynamically change the page layout by moving the named anchor to a new
area of the page.
But each link moves the same named anchor. what am I doing wrong?