jquery loop through children code example
Example 1: jquery loop through each child element
$('#mydiv').children('input').each(function () {
alert(this.value); // "this" is the current element in the loop
});
Example 2: jquery loop over elements
$( "li" ).each(function( index ) {
console.log( index + ": " + $( this ).text() );
});
Example 3: jquery loop through collection backwards
$($("li").get().reverse()).each(function() { /* ... */ });