Meta content attribute
Definition and usage
content
Attribute sets or returns the value of the content attribute of the meta element.
<meta> content attribute Specifies the content of meta information.
Note:The available values of this attribute depend on name and http-equiv The value of the attribute.
See also:
HTML Reference Manual:HTML <meta> Tag
Instance
Example 1
Return the content attributes 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>"; }
Example 2
Change the content attribute of the third meta element in the head (index 2):
document.getElementsByTagName("META")[2].content = "Steve Jobs";
Syntax
Return the content attribute:
metaObject.content
Set the content attribute:
metaObject.content = text
Attribute value
Value | Description |
---|---|
text | Content of Meta Information. |
Technical Details
Return Value: | String, the meta element's content Attribute Value. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <meta> content Attribute