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

HTML Reference Manual

Complete List of HTML Tags

HTML: <button> formtarget Attribute

The formtarget attribute specifies where the response is displayed after submitting the form. The formtarget attribute overrides the target attribute of the form element, which is used in conjunction with type="submit".

 HTML <button> tag

Online Example

A form with two submit buttons. The first submit button submits form data with a default target ("_self"), and the second submit button submits form data to a new window (target = "_blank"):

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

Browser compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 10, Firefox, Opera, Chrome, and Safari support the formtarget attribute.

Note: Internet Explorer 9 Early versions of Internet Explorer do not support the formtarget attribute.

Definition and Usage

The formtarget attribute specifies where the response is displayed after submitting the form. The formtarget attribute overrides the form element's  target  attribute.

This attribute is used in conjunction with type="submit".

HTML 4.01 between HTML5difference

The formtarget attribute is an HTML 5 new attributes.

Note:HTML5Frames and framesets are not supported. _parent, _top, and framename values are now mainly used for iframe.

Syntax

<button type="submit" formtarget="_blank|_self|_parent|_top|framename">

Attribute value

ValueDescription
_blankIn a new window/Submit the form to the document in the tab.
_selfSubmit the form to the document within the same frame (default).
_parentSubmit the form to the document within the parent frame.
_topSubmit the form to the document within the entire window.
framenameSubmit the form to the document within the specified frame.
 HTML <button> tag