$('#YourField').change(function () { var v = parseFloat(this.value); if (isNaN(v)) { this.value = ''; } else { this.value = v.toFixed(2); } });
var intRegex = /^(?:[1-9]\d*(?:\.\d\d?)?|0\.[1-9]\d?|0\.0[1-9])$/;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)