jquery loop through each child element 1

jquery loop through each child element

$('#mydiv').children('input').each(function () {
    alert(this.value); // "this" is the current element in the loop
});

Here is what the above code is Doing:
1. Find the element with the ID of mydiv.
2. Find all of the input elements that are children of the element with the ID of mydiv.
3. Loop through each of the input elements.
4. Alert the value of the current input element.

Similar Posts