Form Validation in JavaScript
Form Validation in JavaScript
As we know, HTML5 has added many form validation attributes. One such attribute is required, The other is a pattern. The form has an onsubmit event which gets triggered when the user submits the form. If the return value for the onsubmit is false, then the form will not get submitted.
Attribute | Value | Description |
accept-charset | character_set |
Specifies the character encodings that are to be used for the form submission |
action | URL |
Specifies where to send the form-data when a form is submitted |
autocomplete | on off |
Specifies whether a form should have autocomplete on or off |
enctype | application/x-www-form-urlencoded multipart/form-data text/plain |
Specifies how the form-data should be encoded when submitting it to the server (only for method="post") |
method | get post |
Specifies the HTTP method to use when sending form-data |
name | text | Specifies the name of a form |
rel | external help license next nofollow noopener noreferrer opener prev search |
Specifies the relationship between a linked resource and the current document |
target | _blank _self _parent _top |
Specifies where to display the response that is received after submitting the form |