금액에 콤마넣기 ( 1,000,000 )

이 펑션이면 쉽게 되요 ~



-- 숫자를 입력해 보세요.



function commas(t) {

var x = t.value;

x = x.replace(/,/gi, '');

x = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");

  $(t).val(x);

}


<input type="text" id="comma" onkeyup="commas(this)" /> -- 숫자를 입력해 보세요.

이 글을 공유하기

댓글

Designed by JB FACTORY