jQuery使用正则判断是否含有非法字符

if(/[@#\$%\^&\*]+/gi.test($("#user_api_register_form").find("input[name='user_name']").val()))
{
$.showErr("用户名含有非法字符",function(){    
$("#user_api_register_form").find("input[name='user_name']").focus();

});
return false;
}

 

posted @ 2017-05-17 10:35  PHP急先锋  阅读(1577)  评论(0编辑  收藏  举报