Introducing form elements
HTML provides us with a variety of elements that are used to build forms. While browsing the web, you may have noticed that online forms typically have similar elements. Most forms will contain input fields such as text inputs, checkboxes, and select boxes.
In this section, we will look at the following HTML form elements:
form
input
label
textarea
fieldset
select
button
form
The first element we need to know about when creating forms is the form
element. This is the outermost element, which contains all other form elements, such as inputs and buttons. The form
element requires you to pass two attributes, which are the action
and method
attributes. The action
attribute allows a developer to specify the URL that the form data will go to after it has been submitted. The method
attribute allows the developer to specify whether the form data should be sent via get
or post
. You will typically use the get
method when...