How would I do to run jquery with multiple input fields to be changed?
I need to be able to put the quantity of each product by clicking minus and .plus
I have this Html
<div class="quantity">
<input type="button" value="+" class="plus">
<input id="value" data-formid="" step="1" max="99" min="1" title="Qty" class="qty" type="number" name="prod[2385]" value="1" size="4">
<input type="button" value="-" class="minus">
</div>
<div class="quantity">
<input type="button" value="+" class="plus">
<input id="value" data-formid="" step="1" max="99" min="1" title="Qty" class="qty" type="number" name="prod[2386]" value="1" size="4">
<input type="button" value="-" class="minus">
</div>
And this Jquery
$('.plus').click(function() { changeValue(1); });
$('.minus').click(function() { changeValue(-1); });
var formID=data("formid");
function changeValue(val) {
var container = $('#value'+formID);
var current = parseInt(container.val(), 10);
container.val(Math.max(0, current + val).toString());
}