HTML Forms: Total Domination
Sobre a Aula

The “target” attribute is a crucial element in HTML forms, determining where the form’s response will be displayed after submission. This attribute offers control over the display behavior of the result.

The “target” attribute can have different values, each influencing the location where the response is displayed. The default value is “_self”, which means the response will open in the same window or tab where the form was filled out.

The “target” attribute can have one of the following values:

ValueDescription
_blankThe response is displayed in a new window or tab
_selfThe response is displayed in the current window
_parentThe answer is displayed in the parent frame
_topThe response is displayed across the entire body of the window
framenameThe response is displayed in a named iframe

This attribute is commonly used when we want to keep the user experience within the same page.

However, there are other options besides the default value. For instance, you can set the “target” to “_blank”, which will cause the response to open in a new window or tab of the browser.

This option is useful when we want to keep the original page intact, displaying the response in a separate context.

Understanding how to use the “target” attribute is valuable, especially when you want to customize the user experience after submitting a form.

By exploring the different values available for this attribute, you gain the ability to more precisely control where the form responses will be displayed, providing a more intuitive experience for the end user.

Therefore, when developing HTML forms, consider the “target” attribute as an essential tool for shaping the display behavior of responses, adapting to the specific needs of your web application.

Here is a simple example:

<form action="/action_page.php" target="_blank">
Entrar na conversa
Rolar para cima