HTML:
input type =“text”id =“custom_expression”
的javascript:
script src =“http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”
$(document).ready(function()
{
$(函数()
{
$( '#custom_Expression')。按键(函数(e)中
{
var txt = String.fromCharCode(e.which);
console.log(txt +':'+ e.which);
如果(!txt.match(/ ^([A-ZA-Z] [0-9]){3} $ / g)的
{
返回false;
}
});
});