Handling User Input

The original idea behind HTML <form> elements was to give web pages a way to send user-supplied data back to a server.[36] The form attributes action and method allow you to specify where and how to send this data when the user clicks the Submit button in the form. While we don’t want to abandon the familiar look and feel of a form, we need a way to capture user input without submitting a request to a server. We want our application to prevent the form submission and take action entirely in the browser.

Now that our app is presenting problems to the users, we’re going to give the users a way to provide an answer. We’ll want them to enter the code for their answer, hit a button to check it, and then see the results displayed ...

Get Serverless Single Page Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.