Form target Property
Example
Change where to display the response that is received after submitting a form (open the response in a new window instead of the same frame as it was clicked):
 document.getElementById("myForm").target = "_blank";
Try it Yourself »
Definition and Usage
The target property sets or returns the value of the target attribute in a form.
The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| target | Yes | Yes | Yes | Yes | Yes | 
Syntax
Return the target property:
 formObject.target
Set the target property:
 formObject.target = "_blank|_self|_parent|_top|framename"
Property Values
| Value | Description | 
|---|---|
| _blank | Opens in a new window | 
| _self | Opens in the same frame as it was clicked (default) | 
| _parent | Opens in the parent frameset | 
| _top | Opens in the full body of the window | 
| framename | Opens in a named frame | 
Technical Details
| Return Value: | A String, representing where to display the response that is received after submitting the form | 
|---|
More Examples
Example
Return the value of the target attribute in a form:
 var x = document.getElementById("myForm").target;
Try it Yourself »
Related Pages
HTML reference: HTML <form> target attribute
❮ Form Object
