HTML contenteditable Attribute

The HTML contenteditable attribute is used to specify whether or not the content of an element is editable.

You can use this attribute on any HTML element. It is a part of the Global Attributes.

The contenteditable attribute can have two values: true (the content is editable) or false (the content is not editable). If this attribute is not set on an element, the element will inherit it if its immediate parent element is editable.

The contenteditable attribute does not have an effect on disabled elements.


<tag contenteditable = "true|false"></tag>

Example of the HTML contenteditable attribute:

<!DOCTYPE html>
    <title>Title of the document</title>
    <p contenteditable="false">
      This is a paragraph. It is not editable.
    <p contenteditable="true">
      This is a paragraph. It is editable. Try to change this text.

Practice Your Knowledge

Which of the following statements are true regarding the HTML contenteditable attribute?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?