in script tag
function ispwd() {
var pwdreg= ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$; //here '^' and '\' are shown invalid characters
var pwdval=$("#pwd").val();
if(!pwdreg.test(pwdval))
{
$("#pwd").after('<span class="error">the password must be 4-8 chars and include at least one upper case letter, one lower case letter, and one numeric digit.</span>');
$("#pwd").focus();
}
}
in html
<p>Password<input type="password" id="pwd" onblur="ispwd()"/></p>onblur from password错误提示javascript错误:'ispwd‘未定义。
发布于 2013-07-08 22:17:37
Javascript regex文本必须包含在/.../字符中。
https://stackoverflow.com/questions/17528921
复制相似问题