HTML <input> formtarget Attribute

Definition and Usage

formtarget attribute can be set to a name or keyword, specifying where the response is displayed after the form is submitted.

formtarget attribute overrides the target attribute

Note:formtarget The attributes can be combined with type="submit" and type="image" Used together.

Example

A form with two submit buttons. The first submit button submits the form data using the default target, and the second submit button submits the form data to a new window:

<form action="/action_page.php">
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Surname:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="submit" value="Normal Submit">
  <input type="submit" formtarget="_blank" value="Submit to New Window">
</form>

Try It Yourself

Syntax

<input formtarget="_blank|_self|_parent|_top|framename">

Attribute Value

Value Description
_blank Display the response in a new window/tab.
_self Display the response in the same frame (default).
_parent Display the response in the parent frame.
_top Display the response in the entire window.
framename Display the response in the named iframe.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support 5.1 10.6