Hi guys, I have a code that allows me a couple of things, as soon as the backspace is, how can I change the regular expression so that it can press enter and only allow 1 comma and max 2 numbers after the comma?
$("[name=price]").keydown(function(e){ if(e.keyCode == 110 || e.keyCode == 190) { e.preventDefault(); $(this).val($(this).val() + ','); } if (/\d|,+|[b]+|-+/i.test(e.key) ){ }else{return false } })
source share