jQuery

// 숫자 타입에서 쓸 수 있도록 format() 함수 추가 Number.prototype.format = function(){ if(this==0) return 0; var reg = /(^[+-]?\d+)(\d{3})/; var n = (this + ''); while (reg.test(n)) n = n.replace(reg, '$1' + ',' + '$2'); return n; }; // 문자열 타입에서 쓸 수 있도록 format() 함수 추가 String.prototype.format = function(){ var num = parseFloat(this); if( isNaN(num) ) return "0"; return num.format(); }; 예제 (jQuery) HTML 20000원 S..
shy1008
'jQuery' 태그의 글 목록