Copy Code code as follows:
$ (function () {
/*jquery Restricted text box can only enter a number * *
$(". Numtext "). KeyUp (function () {
$ (this). Val ($ (this). Val (). replace (/\d|^0/g, ' "));
}. Bind ("Paste", function () {//ctr+v event handling
$ (this). Val ($ (this). Val (). replace (/\d|^0/g, ' "));
}). css ("Ime-mode", "disabled"); CSS settings IME is not available
/*jquery restricted text boxes can only enter numbers and decimal points
$(". Numdectext "). KeyUp (function () {
$ (this). Val ($ (this). Val (). replace (/[^0-9.] /g, "));
}. Bind ("Paste", function () {//ctr+v event handling
$ (this). Val ($ (this). Val (). replace (/[^0-9.] /g, "));
}). css ("Ime-mode", "disabled"); CSS settings IME is not available
});
You can then add a class name to the text box you want to verify, similar to the following:
Copy Code code as follows:
<input type= "text" class= "txt numtext" width= "100px" runat= "Server"/>