First off, I apologize if this is too "noobie" a question or has been answered somewhere else (I can't find it anywhere). I'm new to jQuery, and I'm trying to learn some basics. Anyways, I'm stumped on the following.
How can I convert this to jQuery? var links = ... // Holds an array/ collection of links function myfuction(param){...} // Just a generic function that accepts a parameter for(i=0; i< links.length; i++) { links[i].onclick = myfuction(i); // note that the fuction is being passed the loop control variable } Basically, all I want to do is have the links pass their "reference number" to a function. So far, I got something like this: $("a").each($(this), function(){ .click(function(){ ... }); } At this point, I have no idea where to go. Does the each method have anything similar to a "loop control" variable? I'm sure I can find a work around (ie: number assign each link a number via the rel attribute) but I'd rather learn the correct way that trying to fake it. Any help would be appreciated. Thanks in advance.