JavaScript & Forms

Let's manage forms defined within a web page, in order to improve interactivity.

We'll cover the following

Form recap

Forms enhance web pages by allowing users to input information through text fields, checkboxes, dropdown menus, and more. Inside a web page, a form is defined with a <form> HTML tag, and within this tag, you have your different <input> tags, <select> tags, or <textarea> tags.

If forms are totally new to you, the Mozilla Developer Network has a great introduction aptly named Your first HTML form. For a more general recap on forms, check out this course chapter on OpenClassrooms.

Forms in JavaScript

Data entered into a form by users is normally sent via a network to a web server that processes and sends a response to the browser as a new web page. To do this, web servers use backend programming languages like PHP or Ruby.

Thanks to JavaScript, you can manage forms (and their data) directly within the browser before sending them to an external server. You can notify users of incorrect input data, make suggestions on what they type, and more. Who said forms were boring?

Get hands-on with 1200+ tech skills courses.