Question: Need help completing Murach's Javascript and JQuery Short 7-1 Short 7-1 Use the event object to prevent form submission In this exercise, you'll change the

Need help completing Murach's Javascript and JQuery Short 7-1
Need help completing Murach's Javascript and JQuery Short 7-1 Short 7-1 Use

Short 7-1 Use the event object to prevent form submission In this exercise, you'll change the way the Register application submits the form. Instead of using a regular button and calling the submit() method in code if the validation passes, you'll use a submit button and cancel its default action if the validation fails. Estimated time: 5 to 10 minutes. Register for an Account E-Mail: This field is required. Mobile Phone: This field is required Country Select an option . Please select a country, Contact me by: Text Email Don't contact me Terms of Service: I accept This box must be checked. Rese 1. Open the HTML and JavaScript files in this folder: exercises_short\ch07 egister 2. In the index.html file, find the Register input element and change its type attribute from "button" to "submit". This means the form will be submitted when the button is clicked. Then, run the application and click the Register button to see that you're taken to the confirmation page even though the data is invalid 3. In the main JavaScript file (register.js), change the process Entries function so it accepts the event object as a parameter. Then, change the function so it prevents the default action of the submit button if the validation fails. For this, you can assume you're using the Chrome browser so you don't have to provide for cross-browser compatibility. Short 7-1 Use the event object to prevent form submission In this exercise, you'll change the way the Register application submits the form. Instead of using a regular button and calling the submit() method in code if the validation passes, you'll use a submit button and cancel its default action if the validation fails. Estimated time: 5 to 10 minutes. Register for an Account E-Mail: This field is required. Mobile Phone: This field is required Country Select an option . Please select a country, Contact me by: Text Email Don't contact me Terms of Service: I accept This box must be checked. Rese 1. Open the HTML and JavaScript files in this folder: exercises_short\ch07 egister 2. In the index.html file, find the Register input element and change its type attribute from "button" to "submit". This means the form will be submitted when the button is clicked. Then, run the application and click the Register button to see that you're taken to the confirmation page even though the data is invalid 3. In the main JavaScript file (register.js), change the process Entries function so it accepts the event object as a parameter. Then, change the function so it prevents the default action of the submit button if the validation fails. For this, you can assume you're using the Chrome browser so you don't have to provide for cross-browser compatibility

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!