The effect you see will be the same, but in the first case, a new function is assigned to each li element, since you create a function object inside the each callback.
In the second case, there is only one copy of the event handler, which means that it uses less memory for everyone (although this is probably not measurable).
Internally, click calls on (in jQuery 1.7), which iterates over the elements through each , as well :
return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); });
This applies to many jQuery methods (most often noted in the documentation), so you save characters and memory by letting jQuery implicitly do this.
source share