Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

HTML <button> formtarget Attribute

The formtarget attribute on a submit <button> tag specifies where to display the form response following submission.

The formtarget attribute requires that the <button> is of type submit.

Example

#

A formtarget attribute on the second submit <button> tag.
This button opens a new tab when submitting.

<form action="/tutorial/action.html" target="_self">
  <input type="text" name="name" placeholder="Enter your name">

  <button type="submit">Submit</button>
  <button type="submit" formtarget="_blank">Submit in new tab</button>
</form>

Using formtarget

The formtarget attribute on the button overrides the form's target attribute.

This attribute specifies where to display the response when data is submitted.

Note: The formtarget attribute only works for submit type buttons.


Syntax

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

Values

#

Value Description
_self Opens the page in the same tab/window. This is the default.
_blank Opens the page in a new tab.
_parent Opens the page in the parent iframe. In the same iframe if there is no parent.
_top Opens the page in the topmost part of the iframe. In the same iframe if there is no topmost.
framename Opens the page in a named iframe.

Browser support

Here is when formtarget support started for each browser:

Chrome
9.0 Sep 2011
Firefox
4.0 Mar 2011
IE/Edge
10.0 Sep 2012
Opera
10.6 Jul 2010
Safari
5.1 Sep 2013

You may also like

 Back to <button>
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

Guides