Chapter 8Forms

Forms are the most common method of interacting with a web page. A form is the main component of Google’s home page, and most of us use forms every day to log into our favorite sites. In this chapter, we will look at how forms can be used to interact with a JavaScript program.

In this chapter, we’ll cover these topics:

  • form controls

  • accessing form elements

  • form properties and methods

  • form events

  • submitting a form

  • retrieving and changing values from a form

  • form validation

  • our project―add a form for answering questions and validation

Forms

Forms are made up of a <form> element that contains form controls such as input fields, select menus, and buttons. The form can be filled in by a user and is then submitted to a URL where ...

Get JavaScript: Novice to Ninja 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.