From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../fr/web/api/document/createattribute/index.html | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 files/fr/web/api/document/createattribute/index.html (limited to 'files/fr/web/api/document/createattribute') diff --git a/files/fr/web/api/document/createattribute/index.html b/files/fr/web/api/document/createattribute/index.html new file mode 100644 index 0000000000..fa0f93d1e0 --- /dev/null +++ b/files/fr/web/api/document/createattribute/index.html @@ -0,0 +1,91 @@ +--- +title: document.createAttribute +slug: Web/API/Document/createAttribute +tags: + - API + - DOM + - Méthodes + - Reference +translation_of: Web/API/Document/createAttribute +--- +

{{ApiRef("DOM")}}

+ +

La méthode Document.createAttribute() crée un nouveau nœud d'attribut et le renvoie. L'objet a créé un noeud implémentant l'interface {{domxref("Attr")}}. Le DOM n'impose pas le type d'attribut à ajouter à un élément particulier de cette manière.

+ +
+

Note : La chaîne de caractères donnée dans le paramètre est convertie en minuscules.

+
+ +

Syntaxe

+ +
attribut = document.createAttribute(nom)
+
+ +

Paramètres

+ + + +

Valeur de retour

+ +

Un nœud {{domxref("Attr")}}.

+ +

Exceptions levées

+ + + +

Exemples

+ + +
var node = document.getElementById("div1");
+var a = document.createAttribute("my_attrib");
+a.value = "newVal";
+node.setAttributeNode(a);
+console.log(node.getAttribute("my_attrib")); // "newVal"
+
+

Spécifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('DOM WHATWG','#dom-document-createattribute','Document.createAttribute()')}}{{Spec2("DOM WHATWG")}} Comportement précis avec des caractères majuscules.
{{SpecName('DOM3 Core','core.html#ID-1084891198','Document.createAttribute()')}}{{Spec2('DOM3 Core')}}Pas de modification.
{{SpecName('DOM2 Core','core.html#ID-1084891198','Document.createAttribute()')}}{{Spec2('DOM2 Core')}}Pas de modification.
{{SpecName('DOM1','level-one-core.html#ID-1084891198','Document.createAttribute()')}}{{Spec2('DOM1')}}Définition initiale.
+ +

Compatibilité des navigateurs

+ +

{{Compat("api.Document.createAttribute")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf