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 <form> target Attribute

The target attribute on a <form> tag specifies where to open the response page when the form is submitted.

Options include: in the same tab, a new tab, a new window, and more.

Example

#

A target attribute on a <form> element.
Submitting the form will open a new browser tab.

<form action="/tutorial/action.html" target="_blank">

  <input type="text" name="firstname" placeholder="First name">
  <input type="text" name="lastname" placeholder="Last name">
 
  <button type="submit">Submit</button>
</form>

Using target

The target attribute specifies where, in which tab or window, the form response will open.

Response pages can be opened in the same tab, a new tab, a new window, or an iframe.

If target is not set, the link opens in the same tab/window as the current page.


Syntax

<tagname target="_self | _blank | _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 target support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <form>

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