0
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 the error says javascript error: 'ispwd' is not defined.

1 Answer 1

1

Javascript regex literals must be enclosed in /.../ characters.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.