contenteditable attribute



Contenteditable attribute permits the user to modify the text in a web browser. User cannot edit a text in browser, if this attribute is disabled.
<ele contenteditable="true/false/inherit">
Values added with this attribute are:
trueContent can be modified.
falseContent cannot be altered.
inheritIf the main tag is editable, the content can be changed.

Example Code 1:

Result 1:

You can modify this text portion.

Example Code 2:

Result 2:

You cannot modify this text portion.

Example Code 3:

Result 3:

Content can be altered

Change this content
    Example Code 1 (Explanation):
  • Users can perform actions like selecting text, cut and paste, drag and drop a text, format the text, apply color or add links, if the "True" option is mentioned in the attribute.

  • Example Code 2 (Explanation):
  • At this scenario the content cannot be modified.

  • Example Code 3 (Explanation):
  • Contents can be edited incase the main tag possess value as "True".
  • It is newly launched in HTML5 and it does not exist in previous versions of the HTML.


It will function in all major browsers.

Ask Questions

Ask Question