Attribut contenteditable HTML
The contenteditable attribute is used to specify whether or not the content of an element is editable. Read about this attribute and see on what elements to use.
L'attribut HTML contenteditable permet de spécifier si le contenu d'un élément est modifiable ou non.
Vous pouvez utiliser cet attribut sur n'importe quel élément HTML. Il fait partie des Attributs globaux.
L'attribut contenteditable accepte true, false ou inherit. Une chaîne vide ("") est également valide et se comporte de manière identique à true. Si l'attribut est omis, l'élément hérite la valeur de son parent.
danger
L'attribut
contenteditablen'a aucun effet sur les éléments désactivés.
Syntaxe
Syntaxe de l'attribut contenteditable HTML
<tag contenteditable="true|false"></tag>Exemple de l'attribut contenteditable HTML :
Exemple de l'attribut "contenteditable" HTML
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p contenteditable="false">
This is a paragraph. It is not editable.
</p>
<p contenteditable="true">
This is a paragraph. It is editable. Try to change this text.
</p>
</body>
</html>Practice
Parmi les affirmations suivantes, lesquelles sont vraies concernant l'attribut contenteditable HTML ?