Course Content
Ultimate HTML
Form Creation Basis
The HTML <form>
element is used to create a form on a web page. It is a container for all form elements. Let's consider the next example.
index.html
index.css
index.js
Here are some crucial aspects of the <form>
element:
name
- is a distinct identifier for the form on a webpage. It is used by both the server and client to process the form data. The form name may include numbers, underscores, dashes, and English alphabet characters but must not contain any spaces.autocomplete
- determines if web browsers can automatically fill out form fields. It can be set to"on"
or"off"
and applied to individual form elements.validate/novalidate
- determine if browsers should validate the form fields. Also, these attributes does not have a value.method
- specifies the HTTP method used to send the form data to the server. The two most common methods are GET and POST. This topic will be covered deeper in the JavaScript course.<input/>
element - allow users to input different types of data, such as text, numbers, dates, and more.<label>
element - helps to organize and structure the form. Shows what theinput
is responsible for<button>
type="submit"
- is used to submit the form data to the server.
Note
When a user press
<button type="submit">
, all data in inputs are sent to the server, and a web page reloads. It is the default behavior.
Which HTML element is used to create a submit button for a form?
Select the correct answer
Section 5.
Chapter 2