.each() ... why, whats the benefit?
Hi Guyz and Galz,
I'm a beginner, actually a designer but really enjoying this stuff.
Question about the
.each() function.
Whats the difference between these:
-
$("li").click(function () {
$("li").each(function(){
$(this).toggleClass("example");
});
});
and
-
$("li").click(function () {
$("li").toggleClass("example");
});
They do the same
I am obviously missing something, but why would you want to use .each() what's the benefit.