I am using JQuery to calculate some totals figures and I have run into a problem.
Let’s say I have two sets of inputs, each with a unique name.
$('[name="quantity\\[\\]"]')
$('[name="price\\[\\]"]')
I want to cycle through each set of inputs at the same time so that I can check both for (!isNaN) and (length !== 0), and if the values are valid, I want to multiply them together and add to a running total.
I know I can cycle through one selector using each(), but how can I cycle through two at the same time? is there an elegant way to accomplish this goal?
1 Answer