Copy
$("#box em").html(Math.round($(this).val()*_box_total));
이런 코드가 있는데 <em></em 안에 가격이 들어가거든요.
그래서 10000이면 10,000 이런식으로 콤마를 찍고싶은데
어떤식으로 해야 콤마가 찍힐까요?
|
답변 2개 / 댓글 1개
채택된 답변
+20 포인트
2018-04-15 (일) 14:45:19
그누보드에는 common.js 파일에 number_format 스크립트 함수가 정의되어 있거든용.
common.js 는 기본으로 불러왔을테니..
number_format(Math.round($(this).val()*_box_total));
이렇게 쓰셔도 되고용.
답변에 대한 댓글 1개
아싸호랑나비
2018-04-15 (일) 14:47:55
그렇게 하니 TypeError: data.match is not a function 오류가 나네요.
2018-04-16 (월) 13:26:09
그럼 문자열로 타입을 변경해서 해보세용.
var total = Math.round($(this).val()*_box_total);
total=String(total);
number_format(total);
답변을 작성하려면 로그인이 필요합니다.