English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <form> target Attribute

This article introduces the HTML form target attribute, which specifies a name or keyword indicating where the received response should be displayed after submitting the form. An online example demonstrates how to use the HTML form target attribute, browser compatibility, syntax definition, and detailed information about its attribute values.

 HTML <form> tag

Online Example

Submit a form that opens in a new window or tab, displaying the received response in the new window or tab:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <form> target Attribute Usage-Basic Tutorial(oldtoolbag.com)</title>
</head>
<body>
<form action="action_page.php" method="get" target="_blank">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit">
</form>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the target attribute.

Definition and Usage

The target attribute specifies a name or keyword that indicates where the received response is displayed after submitting the form.

The target attribute defines the name or keyword of the browser context (such as a tab, window, or inline frame).

HTML 4.01 with HTML5differences

HTML5 supports the target attribute.

In HTML 4.01 in, the target attribute is deprecated.

Note:HTML5Since HTML does not support frames and framesets, the _parent, _top, and framename values are now mainly used for iframes.

Syntax

<form target="_blank|_self|_parent|_top|framename">

Attribute value

ValueDescription
_blankIn a new window/Open in a tab.
_selfOpen in the same frame. (Default)
_parentOpen in the parent frame.
_topOpen in the entire window.
framenameOpen in the specified iframe.
 HTML <form> tag