Need help with this. Add the e.preventDefault() command to prevent the browser from responding to the submit event. Create the following variables containing regular expressions: Create the regex1 variable containing a regular expression literal with a character class that matches any uppercase letter A through Z. Create the regex2 variable containing a regular expression literal that matches any single digit. Create the regex3 variable containing a regular expression with a character class containing the symbols !$#%. (Hint: you will have to use \$ for the $ symbol.) Create an if else statement that with the following conditions and outcomes: a. If the length of pwd is less than 8, set the text content of the feedback object to “Your password must be at least 8 characters.” b. Else if the test() method with the regex1 regular expression applied to the pwd variable returns a false value, set the text content of the feedback object to "Your password must include an uppercase letter." c. Else if the test() method with the regex2 regular expression applied to pwd returns false, set the text of feedback to "Your password must include a number." d. Else if the test() method with the regex3 regular expression applied to pwd returns false, set the text of feedback to "Your password must include one of the following: !$#%". e. Otherwise, apply the submit() method to the signupForm object to submit the form for processing. 7. Save your changes to the file and then load in your web browser. Verify that the form cannot be submitted unless a password is provided that has at least eight characters with at least one uppercase letter, one digit, and one of the following characters !$#%. Also verify that if an invalid password is provided, a text message appears on the web form indicating the reason for failure.
Need help with this.
- Add the e.preventDefault() command to prevent the browser from responding to the submit event.
- Create the following variables containing regular expressions:
- Create the regex1 variable containing a regular expression literal with a character class that matches any uppercase letter A through Z.
- Create the regex2 variable containing a regular expression literal that matches any single digit.
- Create the regex3 variable containing a regular expression with a character class containing the symbols !$#%. (Hint: you will have to use \$ for the $ symbol.)
- Create an if else statement that with the following conditions and outcomes: a. If the length of pwd is less than 8, set the text content of the feedback object to “Your password must be at least 8 characters.”
b. Else if the test() method with the regex1 regular expression applied to the pwd variable returns a false value, set the text content of the feedback object to "Your password must include an uppercase letter."
c. Else if the test() method with the regex2 regular expression applied to pwd returns false, set the text of feedback to "Your password must include a number."
d. Else if the test() method with the regex3 regular expression applied to pwd returns false, set the text of feedback to "Your password must include one of the following: !$#%".
e. Otherwise, apply the submit() method to the signupForm object to submit the form for processing.
7. Save your changes to the file and then load in your web browser. Verify that the form cannot be submitted unless a password is provided that has at least eight characters with at least one uppercase letter, one digit, and one of the following characters !$#%. Also verify that if an invalid password is provided, a text message appears on the web form indicating the reason for failure.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images