【发布时间】:2014-12-05 12:21:49
【问题描述】:
这里的错误是不能输入任何字符:
$(document).ready(function() {
$('#t').keypress(function(e){
var txt = String.fromCharCode(e.which);
console.log(txt + ' : ' + e.which);
if(!txt.match(/^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$/)){
return false;
}
})
});
【问题讨论】:
标签: javascript jquery regex