In the previous form examples, you only used one kind of button, the submit button, which was represented by an <input> tag with type set to “submit”. You have other options to use buttons in your forms, here you will review them.

In the Exercise folder, you’ll find a project that includes a number of HTML files.

When you work with forms, you do not have to send the form back to the server, you may run a JavaScript function to respond to the event when the user submits the form.

The Listing below demonstrates this; it shows that every time the user clicks the submit button, the changeBy() JavaScript method is called with “1” passed as the function argument.

Get hands-on with 1400+ tech skills courses.