George Sisco George Sisco - 4 months ago 11x
jQuery Question

how to apply each index value of an array to each value of a group of selected elements

So if I have an array of 2 values and I want to apply those values to two elements, I can't seem to figure out a way to loop through the selected elements and have a counter or something to represent the index of the array value I want to apply.


For example:

myTotal = new Array("7.00", "10.00");

<input class="theTotalInput"></input>
<input class="theTotalInput"></input>

So, once I select the inputs,



yeah... this is where Im stuck. I cannot find any example documentation that shows applying arrays of values to a bunch of elements in turn - all I have seen is applying the same values to a bunch.

Thanks for any help.


var i = 0;
$(".theTotalInput").each(function() {