Dofactory.com
Dofactory.com
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 freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <input> formtarget Attribute

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

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

Example

#

A formtarget attribute on a submit <input> element.
The second submit button will display the form response in a new tab.


<form action="/tutorial/action.html">
  <input name="email" placeholder="Enter your email"><br/>

  <input type="submit" value="Submit 1"/>
  <input type="submit" value="Submit 2" formtarget="_blank"/>
</form>

Using formtarget

The formtarget attribute overrides the form's target attribute.

This attribute specifies where to display the form's response after data is submitted.

This attribute can only be used on input types submit or image.


Syntax

<input type="submit | image" 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
1.0 Dec 2008
Firefox
1.0 Nov 2004
IE/Edge
10.0 Sep 2012
Opera
10.6 Oct 2010
Safari
5.1 Oct 2011

You may also like

 Back to <input>

Last updated on Sep 30, 2023

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 freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides