HTML Forms Attributes Elements
Attributes of <form> Element
Attribute |
Description |
Possible
Values |
Default |
action |
Specifies
the URL where the form data will be sent when the form is submitted. |
A valid
URL (https://example.com) |
None |
method |
Specifies
the HTTP method for sending form data. |
GET, POST |
GET |
name |
Specifies
the name of the form, which can be used to reference the form in JavaScript. |
A string
(e.g., myform) |
None |
target |
Specifies
where to display the response after submitting the form. |
_blank, _self,
_parent, _top, or a frame name (e.g., iframe_name) |
_self |
enctype |
Specifies
the encoding type to use when submitting the form. This is only used when method="POST". |
application/x-www-form-urlencoded
(default), multipart/form-data, text/plain |
application/x-www-form-urlencoded |
autocomplete |
Specifies
whether the browser should automatically complete input fields based on
previous entries. |
on or off |
on |
accept-charset |
Specifies
the character encoding for the form submission. |
Any valid
charset (e.g., UTF-8) |
None |
novalidate |
Specifies
that the form should not be validated before submission. |
novalidate
(this is a boolean attribute) |
None |
method |
Specifies
the HTTP method to be used when sending form data. |
GET, POST |
GET |
action |
The URL
where the form data will be sent for processing. |
A URL (https://example.com) |
None |
id |
Specifies
a unique identifier for the form. Used to reference the form in JavaScript or
CSS. |
A string
(e.g., myform) |
None |
Comments
Post a Comment