<input type='number' name="productId" id="productId" value="5">
<input type="number" name="quantity[]" id="quantity">
In order to retrieve the quantity value, I utilized
var values = $("input[name='quantity[]']")
.map(function(){return $(this).val();}).get();
The process functions smoothly to retrieve the desired value. Now, my objective is to designate productId
as the key and the quantity values as numbers. The interface includes a submit button. Upon entering the product ID and quantity, the values will be added to an array. I aim to store these in a new array structured as follows:
var array = {
2:10,
3:5
};