Input Submit formTarget Attribute
Definition and Usage
formTarget
Sets or returns the value of the formtarget attribute of the submit button.
The HTML formtarget attribute specifies a name or keyword that indicates where the response received after submitting the form should be displayed.
The formtarget attribute overrides the target attribute of the <form> element target attribute.
Note:The formtarget attribute is a new attribute of the <input> element with type="submit" in HTML5.
See also:
HTML Reference Manual:HTML <input> formtarget Attribute
Example
Example 1
Find out where the response is displayed after submitting the form:
var x = document.getElementById("mySubmit").formTarget;
Example 2
Change the value of the formtarget attribute of the submit button:
document.getElementById("mySubmit").formTarget = "_self";
Syntax
Return the formTarget attribute:
submitObject.formTarget
Set the formTarget attribute:
submitObject.formTarget = "_blank|_self|_parent|_top|framename"
Attribute Value
Value | Description |
---|---|
_blank | The response is displayed in a new window/tab. |
_self | The response is displayed in the same frame (default). |
_parent | The response is displayed in the parent frame. |
_top | The response is displayed in the entire window. |
framename | The response is displayed in the named iframe. |
Technical Details
Return Value: | A string value indicating where the response is displayed after the form is submitted. |
---|
Browser Support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |