Meta content Property
Example
Return the value of the content attribute of all meta elements:
var x = document.getElementsByTagName("META");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
txt = txt + "Content of "+(i+1)+". meta tag: "+x[i].content+"<br>";
}
Try it Yourself »
Description
The content property sets or returns the value of the content attribute of a meta element.
The content attribute specifies the content of the meta information.
Note: The available values of this property depends on the value of the name and the httpEquiv properties.
Browser Support
Property | |||||
---|---|---|---|---|---|
content | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the content property:
metaObject.content
Set the content property:
metaObject.content = text
Value | Description |
---|---|
text | The content of the meta information |
Return Value
Type | Description |
---|---|
String | The value of the content attribute of the meta element |
More Examples
Example
Change the value of the content attribute of the third meta element (index 2) in head:
document.getElementsByTagName("META")[2].content = "Bill Mosley";
Try it Yourself »
❮ Meta Object