I have the following form, and I am dynamically adding more dropdowns (exactly the same as these) if the user clicks on the link to add more items
<div class="dynamic-sale">
<select name="sizes[]" id="sizes" class="entry-dropdown">
<option value="3XL">3XL</option>
<option value="2XL">2XL</option>
<option value="XL">XL</option>
<option value="L">L</option>
<option value="M">M</option>
<option value="YL">YL</option>
<option value="YM">YM</option>
</select>
<select name="number[]" id="amount" class="entry-dropdown">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<select name="price[]" id="price" class="entry-dropdown">
<option value="15">$15</option>
<option value="12.5">$12.5</option>
<option value="10">$10</option>
<option value="0">Free</option>
</select>
</div>
My question I have is, I want to take the results and have them in a format where I can add everything up.
so it'll say how many sizes of each I have, how many of each size, and the price. I'm assuming i need a multidimentional array.
I currently have:
$('#order-submit').click(function(){
var size = [];
var price = [];
var quantity = [];
$.each($('.entry-dropdown'), function() {
size.push($(this).val());
});
console.log(size);
But all this give me was a single array: ["XL", "3", "15", "3XL", "1", "15"] (when I tested it)
What would be the best way to get that data in a useable format?
I hope that makes sense! Thanks