Skip to content

Instantly share code, notes, and snippets.

View sskim91's full-sized avatar
😘

sskim sskim91

😘
View GitHub Profile
@sskim91
sskim91 / comma_input_keyup.js
Created December 31, 2023 08:52
Add comma/dot to number input on keyup event
$('input.number').val(function(index, value) {
return value
.replace(/\D/g, "")
.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
;
}).keyup(function(event) {
// skip for arrow keys
if(event.which >= 37 && event.which <= 40) return;
// format number
$(this).val(function(index, value) {