Anchor charset Property
Anchor Object
Definition and Usage
charset can set or return the value of the link's charset attribute.
The charset attribute specifies the character set of the linked resource.
Syntax
Set the charset attribute:
anchorObject.charset="
charset
"
Return the charset attribute:
anchorObject.charset
| Value | Description |
|---|---|
| charset | Specifies the character set of the linked resource. |
Browser support





All major browsers support the charset property.
Example
Example
Returns the charset attribute value of the link:
<!DOCTYPE html><html>
<head>
<meta charset="utf-8">
<title>Runoob Tutorial(runoob.com)
title
head
<body>
<a id="runoob" charset="ISO-8859-1" href="//www.runoob.com/">Runoob Tutorial
a
<
br
<
scriptdocument.write("Returns the link's charset: "); document.write(document.getElementById('runoob').charset); document.write("
<
br
<
br");
script
<a id="google" href="//www.google.com/" Google a>
<br>
<script>document.getElementById('google').charset="utf-8"; document.write("Sets the link's charset: "); document.write(document.getElementById('google').charset);
script
body
html
Try it »
Anchor Object