$(".mid-sl .sl-left").click(function(event) {
var vl = $(this).siblings("input").val();
var dj = $(this).parent().siblings(".mid-dj").children('span').text();
if (vl>1) {
vl--;
$(this).siblings("input").val(vl);
$(this).parent().siblings(".mid-je").children('span').text(dj*vl);
}
});
<div class="mid-sl f-l">
<a href="JavaScript:;" class="sl-left" id="${cartI.productExt.pid}" name="reduce">-</a>
<input type="text" name="num" id="${cartI.productExt.pid}" value="${cartI.count}" />
<a href="JavaScript:;" class="sl-right" id="${cartI.productExt.pid}" name="plus">+</a>
</div>
<p class="mid-dj f-l">¥ <span>${cartI.price}</span></p>
<p class="mid-je f-l">¥ <span>${cartI.sum}</span></p>
网友评论