Input Submit formTarget Property

❮ Input Submit Object

Example

Find out where the response will be displayed after submitting a form:

var x = document.getElementById("mySubmit").formTarget;
Try it Yourself »

Description

The formTarget property sets or returns the value of the formtarget attribute of a submit button.

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

The formtarget attribute overrides the target attribute of the <form> element.

Note: The formtarget attribute is new for the <input> element with type="submit" in HTML5.


Browser Support

Property
formTarget Yes 10.0 Yes Yes Yes


Syntax

Return the formTarget property:

submitObject.formTarget

Set the formTarget property:

submitObject.formTarget = "_blank|_self|_parent|_top|framename"

Property Values

Value Description
_blank The response is displayed in a new window/tab
_self The response is displayed in the same frame (this is default)
_parent The response is displayed in the parent frame
_top The response is displayed in the full body of the window
framename The response is displayed in a named iframe

Technical Details

Return Value: A String, representing where to display the response after submitting the form

More Examples

Example

Change the value of the formtarget attribute of a submit button:

document.getElementById("mySubmit").formTarget = "_self";
Try it Yourself »

Related Pages

HTML reference: HTML <input> formtarget attribute


❮ Input Submit Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.