04. Preventing Default πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

πŸ› Submit Button on Form Returns 404 Error

Work with a partner to resolve the following issues:

  • Users should be able to see the calculated tip amount and total on the screen after clicking on the submit button.

  • Fix the code so that the actual behavior reflects the expected behavior

Expected Behavior

When a user enters numbers in the text fields and clicks on the Calculate Tip button, calculated totals for both the tip amount and total should appear on screen.

Actual Behavior

When a user clicks on the Calculate Tip button, a 404 error appears.

Assets

The following image demonstrates the web application’s appearance and functionality:

The Tip Calculator app has returned a tip amount of 2.00 and a total of 12.00, for a meal cost of 10 and tip of 20%.


πŸ’‘ Hints

What action may be preventing the calculated totals from being rendered correctly on the page? How can we cancel that action?

πŸ† Bonus

If you have completed this activity, work through the following challenge with your partner to further your knowledge:

  • Even when an event is canceled, it continues to propogate. What does that mean?

Use Google or another search engine to research this.


βœ… Solutions

Solutions Click Here