 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Input Submit formTarget property
The HTML DOM Input Submit formTarget property is used for setting or returning the formTarget attribute value of a submit button. The HTML DOM Input Submit formTarget property is where the response from server should be displayed after the form data being submitted. The formTarget property overrides the target property of the form element. It introduced in HTML5 for input element with type submit.
Syntax
Following is the syntax for −
Setting the formTarget property −
submitObject.formTarget = "_blank|_self|_parent|_top|framename"
Here, _blank will open the response in new window;_self will open the response in the same window; parent will open in the parent frame ; _top will open in full window body and framename will open it in a specified named frame.
Example
Let us look at an example for the Submit formTarget property −
<!DOCTYPE html> <html> <body> <h1>Submit formTarget property</h1> <form id="FORM_1" action="/Sample.php" style="border:solid 2px green;padding:2px"> UserName: <input type="text" id="USR"> <br> Location: <input type="text" id="Loc"> <br><br> <input type="submit" id="SUBMIT1" formtarget=_self> </form> <p>View the form response in the new window instead of same window by clicking the below button</p> <button onclick="changeTarget()">CHANGE</button> <p id="Sample"></p> <script>    function changeTarget() {       document.getElementById("SUBMIT1").formTarget="_blank";       document.getElementById("Sample").innerHTML = "The response will now open in the new window"; } </script> </body> </html> Output
This will produce the following output −

On clicking the CHANGE button −

