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

HTML Reference Manual

HTML Tag Reference

HTML: <input> formtarget attribute

The 'formtarget' attribute specifies a name or keyword that indicates where the received response is displayed after submitting the form, which will override the 'target' attribute of the '<form>' element.

 HTML <input> tag

Online Example

A form with two submit buttons and different target windows:

<!DOCTYPE html>
<html>
<head>
<title>HTML: <input> formtarget attribute - 基础教程网(oldtoolbag.com)</title>
<body>
<form action="action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit as normal">
  <input type="submit" formtarget="_blank" value="Submit to a new window/tab">
</form>
</body>
</html>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

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

Note:Internet Explorer 9 Previous versions do not support the 'formtarget' attribute of the '<input>' tag.

Definition and Usage

The 'formtarget' attribute specifies a name or keyword that indicates where the received response is displayed after submitting the form.

The formtarget attribute overrides the <form> element's target attribute.

Note:The formtarget attribute can be used with type="submit" and type="image".

HTML 4.01 with HTML5difference

The formtarget attribute is an HTML5 new attributes added

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

Syntax

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

Attribute value

ValueDescription
_blankIn a new window/Display the response in the tab.
_selfDisplay the response in the same frame (default).
_parentDisplay the response in the parent frame.
_topDisplay the response in the entire window.
framenameDisplay the response in the specified iframe.
 HTML <input> tag