1, $.each(a,f);
2,$("a").each(f);
i know the last line meaning, which represents all <a> elements in the document. Then call the each() method then invoke the function f once for each selected element. but i don’t know what’s the meaning of the first one? and what’s the use of it? thank you.
Be careful, in your example
adoes not need to be the same type of object.$.each(array, function)is for being used on normal arrays.The idea behind
$(selector).each(function)is the possibility to use theeach“operator” on the result of a jQuery selector.Here are the links to both ways of using
each:http://api.jquery.com/jQuery.each/
http://api.jquery.com/each/