1var arr = ['one','two','three','four','five'];
2$.each(arr, function(index, value){
3 console.log('The value at arr[' + index + '] is: ' + value);
4});
1$( "li" ).each(function( index ) {
2 console.log( index + ": " + $( this ).text() );
3});
1//looping through list elements in jquery
2$('#myUlID li').each(function() {
3 console.log($(this));
4})
1$( "li" ).each(function( index ) {
2 console.log( index + ": " + $( this ).text() );
3});
4
1//Array
2$.each( arr, function( index, value ){
3 sum += value;
4});
5
6//Object
7$.each( obj, function( key, value ) {
8 sum += value;
9});
1$.each(largeJSONobject.ReleatedDoc, function (index,value) {
2 $('select.mrdDisplayBox').addOption(value.Id, value.Id + ' - ' + value.Number, false);
3});