我想允許輸入具有這些組合的手機號碼(7或8或9)。jQuery允許手機號碼的具體號碼
我只限制字母(只允許數字),但如何限制其他的數字比7或8或9
$(document).on('keypress', '.mobnum', function (e) {
//if the letter is not digit then display error and don't type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
if (e.which == 118){
return true;
}else{
return false;
}
}
});
您可以使用正則表達式承擔,即像'^ [789] \ d印度數{9} $' – Satpal
thanks..but如何按鍵進行整合 – vishnu