Specifying a Target for the Form Response

The browser default behavior is to replace the form page with the response. You can change this behavior by using the target attribute. This attribute works in the same way as the target attribute on the a element.

Values for the target attribute of the form element

AttributeDescription
_blankOpens the response in a new window (or tab)
_parentOpens the response in the parent frameset
_selfOpens the response in the current window (which is the default behavior)
_topOpens the response in the full body of the window.
<frame> Opens the server response in the specified frame
 
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
      <form target="_blank" method="post" action="http://yourServer/form">
            <input autocomplete="on" name="fave" /> <input name="name" />
            <button>Submit Vote</button>
      </form>
</body>
</html>
  
Click to view this demo.
Home 
  HTML CSS Book 
    HTML  

form:
  1. <form> to get user input
  2. Using the base Element to Set a Destination for Form Data
  3. Configuring the HTTP method Attribute for Form element
  4. Configuring the Form Data Encoding
  5. Controlling Form Completion
  6. Specifying a Target for the Form Response
  7. Setting the Name of the Form
  8. Adding Labels to a Form
  9. Automatically Focusing on an input Element
  10. Disabling Individual input Elements
  11. Form Elements Outside the Form
Related: