Skip to content

Instantly share code, notes, and snippets.

Created January 27, 2013 03:45
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/4646158 to your computer and use it in GitHub Desktop.
Yo dawg, I herd you like loops, so jQuery put a loop in your code
// Indications of Confusion
$( ".bla" ).each( function() {
$( this ).css( "color", "green" );
});
// Explicit Loops
$( ".bla" ).each( function( index, element ) {
$( element ).append( index );
});
// Implicit Loops
$( ".bla" ).addClass( "highlight" );
// Performance Implications
$( ".bla" ).css( "x", "y" ).css( "a", "b" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment