$(".add").click(function(){ var tol = ""; $(".basket tr").each(function(){ var wow = $(this).find(".jg").html(); var num = $(this).find(".gs")[0].value; tol += parseInt(wow*num); console.log(tol); }) $(".basket-price p").html(tol + "元")})我的想法大概就是每點(diǎn)擊增加數(shù)目 的時(shí)候進(jìn)行一下總數(shù)目計(jì)算,但是打印出來就成了字符串拼接了。。用了parseInt。。這是什么情況呢
jQuery實(shí)現(xiàn)購物車功能 總價(jià)格相加
安靜的沙漠
2017-01-11 09:39:31