Created
May 15, 2014 10:46
-
-
Save carlosrojaso/25cbe18abee97801a434 to your computer and use it in GitHub Desktop.
Jquery each
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returns "lots of extra whitespace" | |
$.trim( " lots of extra whitespace " ); | |
var myArray = [ 1, 2, 3, 5 ]; | |
if ( $.inArray( 4, myArray ) !== -1 ) { | |
console.log( "found it!" ); | |
} | |
<ul> | |
<li><a href="#">Link 1</a></li> | |
<li><a href="#">Link 2</a></li> | |
<li><a href="#">Link 3</a></li> | |
</ul> | |
$( "li" ).each( function( index, element ){ | |
console.log( $( this ).text() ); | |
}); | |
// Logs the following: | |
// Link 1 | |
// Link 2 | |
// Link 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment