Learn more about form tags that HTML uses to create inputforms. When and how should we use it?
# form tag in HTML
Since form tags are important tags that are used very often, let's take a closer look at them one by one.

! If you use form tags:?
First, the function of the form tag is to obtain specific information from visitors on a webpage and send it to the server. So you have an input, an input, a textarea, a tag element that you can get input from inside. It's typically as follows.
<form>
  <input type="text" value="" name="title" />
  <textarea name="description"></textarea>
</form>

So what are the attributes that you can apply to form? The following properties are used:

  • action  //  page url to move when form is submit
  • method  //  Select HTTP method method such as get, post, etc. (Default. GET)
  • target  //  How the browser window behaves when you are subset and on the move
  • enctype  //  Select encoding method when using POST method
  • name  //  Set name value for form
  • autocomplete  // Properties added to HTML5 that have auto-completion capabilities

The most frequently used essential properties of these properties are probably action and method. The rest can be selected and used as needed. So let's use a simple example below.


# Example of form tag
If you think about creating a contact us page to receive information from visitors and send it to the server, you can create a page as shown below.
<form action="/submit/" method="get">
  <input name="username" type="text" placeholder="name" />
  <textarea name="content" placeholder="Please enter your content."></textarea>
  <button>Submit</button>
</form>

Now enter the Submit button and your input will be forwarded to the /submit/ page. Note that the button tag is automatically defaulted to submit if it is declared inside the form


! On closing
The submit method of the form tag is not asynchronous, so it switches to the page or opens a new window. If you are using ajax, you can transfer data without using the form tag, so please note. However, even if it is asynchronous, it is often used as a semantic element when you receive data.