Skip to content

Commit

Permalink
Fix: 가격 렌더링 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
quokka-eating-carrots committed Mar 12, 2023
1 parent 8c62f40 commit 9e5152c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions js/payment.js
Expand Up @@ -37,13 +37,16 @@ export function lookProducts() {

// 가격 렌더링
function renderTotalPrice() {
const totalPriceEl = $('.total-price', document, true);
const products = $('.products tr', document, true);
const totalPriceEl = document.querySelectorAll('.total-price');
const products = document.querySelectorAll('.products tr');
let totalPrice = 0;
products.forEach((el) => {
if ($('.product-checkbox', el).checked) {
if (el.querySelector('.product-checkbox').checked) {
totalPrice += parseInt(
$('td:last-child', el).textContent.slice(0, -1).replace(',', ''),
el
.querySelector('td:last-child')
.textContent.slice(0, -1)
.replace(',', ''),
); // 로케일 문자를 숫자로 변환
}
});
Expand Down

0 comments on commit 9e5152c

Please sign in to comment.