English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The formtarget attribute specifies where the response is displayed after submitting the form. The formtarget attribute overrides the target attribute of the form element, which is used in conjunction with type="submit".
A form with two submit buttons. The first submit button submits form data with a default target ("_self"), and the second submit button submits form data to a new window (target = "_blank"):
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <button> formtarget Attribute Usage-Basic Tutorial(oldtoolbag.com)</title> </head> <body> <form action="action_page.php" method="get"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <button type="submit">Submit</button> <button type="submit" formtarget="_blank">Submit to a new window</button> </form> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 10, Firefox, Opera, Chrome, and Safari support the formtarget attribute.
Note: Internet Explorer 9 Early versions of Internet Explorer do not support the formtarget attribute.
The formtarget attribute specifies where the response is displayed after submitting the form. The formtarget attribute overrides the form element's target attribute.
This attribute is used in conjunction with type="submit".
The formtarget attribute is an HTML 5 new attributes.
Note:HTML5Frames and framesets are not supported. _parent, _top, and framename values are now mainly used for iframe.
<button type="submit" formtarget="_blank|_self|_parent|_top|framename">
Value | Description |
---|---|
_blank | In a new window/Submit the form to the document in the tab. |
_self | Submit the form to the document within the same frame (default). |
_parent | Submit the form to the document within the parent frame. |
_top | Submit the form to the document within the entire window. |
framename | Submit the form to the document within the specified frame. |