formtarget
formtarget attribute
The formtarget
attribute in HTML indicates the name or keyword of a browsing context (like a tab, window, or iframe) where the form submission results will be shown. It is used with form elements such as <input>
and <button>
, especially those of type "submit"
.
Syntax
<input formtarget="_blank|_self|_parent|_top|framename">
Example
Here’s an example of how the formtarget
attribute works:
<form method="post">
<input type="text" name="username" placeholder="Username">
<input type="submit" value="Submit" formtarget="_blank">
</form>
formtarget
attribute can be used with elements of type="submit"
and type="image"
.Values
- _blank: Opens the submission results in a new tab.
- _self: Displays the results in the same tab/window (default).
- _parent: Opens the results in the parent iframe, or in the current iframe if no parent exists.
- _top: Displays the results in the topmost frame, or in the same iframe if no topmost frame is present.
- framename: Opens the results in a specific named iframe.
Applies To
The formtarget
attribute can be used with the following HTML elements.
Example
<form method="post">
Name:<br><input type="text" name="name"><br><br>
Email:<br><input type="email" name="email"><br><br>
<input type="submit" value="Submit (New Window)" formtarget="_blank">
<input type="submit" value="Submit (Same Window)" formtarget="_self">
</form>
Conclusion
The formtarget
attribute specifies where the form submission results will appear, such as in a new tab, the current window, or within an iframe. It can be used with <input>
and <button>
elements. Key values include _blank
, _self
, _parent
, and _top
to define the target browsing context.
formnovalidate
The formnovalidate attribute allows form submission without triggering validation checks when used with <button> or <input type="submit">, bypassing the default validation rules.
high
The high attribute in HTML is used with <meter> elements to define the upper threshold of a scalar value within a specified range.