I called a class called test for my textbox. When I entered the first value for e.g. the first value as 4., then suddenly the output coming as 4.00
4.
4.00
$(document).on("keyup", ".ctc", function () { if (!this.value.match(/^\s*\d*\.?\d{0,2}\s*$/) && this.value != "") { this.value = ""; this.focus(); alert("Please Enter only alphabets in text"); } });