숫자 증가 할떄마다 곱하기 해주기
var $quantity=$('.quantity'),
$unitprice = $quantity.attr('data-unitprice'),
$qtyBtn = $quantity.find('span'),
$qytInput =$quantity.find('input'),
$targetTotal=$('.total_price .price');
$qtyBtn.click(function(){
var currentCount = $qytInput.val();
if($(this).hasClass('plus')){
$qytInput.val(++currentCount);
console.log($qytInput)
}else{
if(currentCount > 1){
$qytInput.val(--currentCount);
}
}
console.log(currentCount)
console.log($unitprice)
var total = (currentCount * $unitprice).toLocaleString('en');
$targetTotal.text(total+'$');
});
data-unitprice에 고정값이있으면 잘되는데 js로 불러온다면 문제가 생긴다 ㅡㅡ