금액에 콤마넣기 ( 1,000,000 )
- 컴퓨터/jquery
- 2019. 1. 11. 09:31
이 펑션이면 쉽게 되요 ~
-- 숫자를 입력해 보세요.
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)" /> -- 숫자를 입력해 보세요.
이 글을 공유하기