Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html
web
input

HTML forms

Educative Answers Team

In HTML, forms are a way of receiving input from users and are, therefore, very useful for collecting website data. Forms have a lot of relevance in modern times as they are commonly used for sign-ups, authentication, and comments.

A form can be created with the form tag.

However, the tag alone isn’t of much use. So, HTML provides a variety of attributes and elements that extend the functionality of forms.

Form input

The most useful component of a form is the input tag, which creates a text field where users can enter data. Here’s an example:

As seen in the code above, there is a type and name associated with inputs. The type defines the nature of the input (text, submit, etc), while the name allows us to access the input data for future use. You can think of the name as a variable in which the input data is stored. Other properties of input include:

  • size
  • value
  • maxlength
  • readonly

Submission button

A button can be used to submit the data in a form. This is where the name of the form will come in handy.

For more details on HTML form attributes, check out the official documentation.

RELATED TAGS

html
web
input
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring