0
我想限制輸入特定號碼的特殊數字,到目前爲止,我還侷限於一些符號和文字:限制輸入
<input type="text" id="txtPageNumber" class="txtPageNumber" onkeyup="this.value = this.value.replace(/[^0-9\.]/g,'')" value="" />
,但我不想讓人們進入剛剛特殊數字,例如:從1至16 ...
我想限制輸入特定號碼的特殊數字,到目前爲止,我還侷限於一些符號和文字:限制輸入
<input type="text" id="txtPageNumber" class="txtPageNumber" onkeyup="this.value = this.value.replace(/[^0-9\.]/g,'')" value="" />
,但我不想讓人們進入剛剛特殊數字,例如:從1至16 ...
正如您所標記的使用jQuery你的問題,這裏是你如何可以使用jQuery validation plugin
$("#myform").validate({
rules: {
txtPageNumber: {
required: true,
range: [1,16]
}
}
});
有沒有更簡單的方法來實現呢? – abrabr 2011-02-03 13:39:48