for the given html:
<div id="parent">
<div class="child">x</div>
<div class="child">y</div>
<div class="child">z</div>
</div>
How can I map the text of its children from an array?
This is my try:
var myArray = ['a', 'b', 'c'];
for (var i = -1; i < myArray.length; i++) {
$('#parent .child').each(function () {
$(this).text(myArray[i]);
});
}
I get: c,c,c
How can I get a,b,c ?