jQuery add commas while user typing numbers - number_format - numberwithcommas
$('body').on('keyup','.amount-row',function(event){
// skip for arrow keys
if(event.which >= 37 && event.which <= 40) return;
// format number
$(this).val(function(index, value) {
return value
.replace(/,/g, '',"")
.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
;
});
})
Belum ada Komentar untuk "jQuery add commas while user typing numbers - number_format - numberwithcommas"
Posting Komentar