Form acceptCharset Attribute
Definition and Usage
acceptCharset
Sets or returns the value of the accept-charset attribute in the form element.
The HTML accept-charset attribute specifies the character set to be used for form submission.
The default value is the reserved string "UNKNOWN" (indicating that the encoding is equal to the encoding of the document containing the <form> element).
See also:
HTML Reference Manual:HTML <form> accept-charset Attribute
Example
Example 1
Return the character set that the server should use for form submission:
var x = document.getElementById("myForm").acceptCharset;
Example 2
Change the value of the accept-charset attribute in the form to UTF-8:
document.getElementById("myForm").acceptCharset = "UTF-8";
Syntax
Return the acceptCharset attribute:
formObject.acceptCharset
Set the acceptCharset attribute:
formObject.acceptCharset = character-set
Attribute value
Value | Description |
---|---|
character-set |
Character encoding list used for form submission, separated by spaces or commas. Common values:
In theory, any character encoding can be used, but no browser can understand all encodings. The more widely a character encoding is used, the greater the chance that the browser will understand it. To view all available character encodings, please visit ourCharacter Set Reference Manual. |
Technical Details
Return Value: | A string value indicating the character set that should be used to submit the form to the server. |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |