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 the meta information.

Note:The available values of this attribute depend on name and http-equiv The value of the attribute.

See also:

Manuel de référence HTML :Balise <meta> HTML

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>";
}

Try it yourself

Example 2

Change the content attribute of the third meta element in the head (index 2):

document.getElementsByTagName("META")[2].content = "Steve Jobs";

Try it yourself

Syntax

Return the content attribute:

metaObject.content

Set the content attribute:

metaObject.content = text

Attribute value

Value Description
text Contenu des métadonnées.

Détails techniques

Valeur de retour : Chaîne, l'élément meta Attribut content valeur.

Support du navigateur

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Pages associées

Manuel de référence HTML :Attribut content du balise <meta> HTML