Quantity Stepper with Total
A plus/minus quantity input that recalculates a live total.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div class="card border-0 shadow-sm" style="max-width:280px"><div class="card-body text-center">
<h6 class="fw-bold mb-2">Quantity</h6>
<div class="input-group justify-content-center"><button class="btn btn-outline-secondary" id="qMinus">−</button><input class="form-control text-center" id="qVal" value="1" style="max-width:70px"><button class="btn btn-outline-secondary" id="qPlus">+</button></div>
<small class="text-secondary mt-2 d-block" id="qTotal">Total: $29</small>
</div></div>var v=document.getElementById('qVal'),tot=document.getElementById('qTotal'),n=1;
function upd(){v.value=n;tot.textContent='Total: $'+(n*29)}
document.getElementById('qPlus').onclick=function(){n++;upd()};
document.getElementById('qMinus').onclick=function(){if(n>1){n--;upd()}};Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.