如何验证文本框值只有1到9个数字 [英] How to validate the text box value only 1 to 9 numbers
本文介绍了如何验证文本框值只有1到9个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何验证文本框值只有1到9个数字而不是0以下是我的代码...
How to validate the text box value only 1 to 9 numbers not for the 0 below is my code ...
$(document).ready(function () {
$("#MainContent_txtPrice").keyup(function () {
if (isNaN(parseInt($(this).val()))) {
$(this).val('');
} else {
$(this).val(parseInt($(this).val()).toString());
}
});
});
推荐答案
(document).ready(function(){
(document).ready(function () {
( #MainContent_txtPrice)。keyup(function(){
if (isNaN(parseInt(
("#MainContent_txtPrice").keyup(function () { if (isNaN(parseInt(
)
( this )。val()))){
(this).val()))) {
这篇关于如何验证文本框值只有1到9个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文