hi everyone,
I used to have a text input for entering normal digits by the user as below:
<input name="honorarium" value="0" type="text" class="number" />
which I validated the input by :
Validation.Add("honorarium", Validator.Required(), Validator.Decimal());
but after a while I decided to separate the input number for the user by "commas" for every 3 digits using the script below:
$('input.number').keyup(function (event) {
// skip for arrow keys
if (event.which >= 37 && event.which <= 40) return;
// format number
$(this).val(function (index, value) {
return value
.replace(/\D/g, "")
...
Go to the complete details ...