HTML · HTML Forms · Lesson 41
HTML Form Attributes
action, method, target and autocomplete.
Form attributes control where and how form data is sent.
Example
<form action="/action_page.php" method="get" target="_blank" autocomplete="on">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname" value="John">
<input type="submit" value="Submit">
</form>
| Attribute | Description |
|---|---|
| action | The URL where the form data is sent |
| method | HTTP method: GET (default) or POST |
| target | Where to show the response (_self, _blank, ...) |
| autocomplete | Whether the browser can autofill fields (on/off) |
| novalidate | Do not validate the form when submitted |
| enctype | How data is encoded (needed for file uploads with POST) |
GET vs POST
Keep reading “HTML Form Attributes”
Sign up to read the full lesson (1 more parts), try every example in the live editor, and take the 5-question quiz.