반응형
jQuery function to to format number with commas and decimal
http://stackoverflow.com/questions/14075014/jquery-function-to-to-format-number-with-commas-and-decimal
문자열 숫자체크
,제거 후 자리수 계산하여 , 다시 삽입
function ReplaceNumberWithCommas(ctrl) {
yourNumber = ctrl.value;
yourNumber = yourNumber.replace(/,/g, '');
var n = yourNumber.toString().split(".");
n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
ctrl.value =n.join(".");
}
http://stackoverflow.com/questions/14075014/jquery-function-to-to-format-number-with-commas-and-decimal
문자열 숫자체크
,제거 후 자리수 계산하여 , 다시 삽입
function ReplaceNumberWithCommas(ctrl) {
yourNumber = ctrl.value;
yourNumber = yourNumber.replace(/,/g, '');
var n = yourNumber.toString().split(".");
n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
ctrl.value =n.join(".");
}
반응형
'jQuery' 카테고리의 다른 글
테이블 소팅 (0) | 2015.09.01 |
---|---|
XSS 공격 문자열 치환 스크립트 (0) | 2015.09.01 |
활용 가능 소스 있는 사이트 (0) | 2015.09.01 |
매개변수로 데이터 넘겨서 $.each로 해당 아이디요소 데이터 처리하기 (0) | 2015.09.01 |
각 태그의 속성(이벤트)변경시 attr로 안될 경우. (0) | 2015.09.01 |
댓글