HTML - DOM Element isContentEditable Property



The HTML DOM Element isContentEditable property is used to check if a webpage element can be edited by users directly or not.

This property returns a boolean value true, only if the users can edit the content of a specific element on the webpage, and false if the content is not editable by users.

Syntax

Following is the syntax of the HTML DOM Element isContentEditable property −

element.isContentEditable

Parameters

Since this is a property, it will not accept any parameter.

Return Value

This property returns true if the element content can be edited by the user and false otherwise.

Example 1: Checking Content Editable

If the content is editable, the HTML DOM Element isContentEditable property will return true



 
HTML DOM Element isContentEditable


HTML DOM Element isContentEditable property

Element's content can be edited...

This div is editable. Edit Me!

The above program returns "true", because the div element content can be edited by users.

Example 2: Content Non-Editable

Following is another example of the HTML DOM Element isContentEditable property. Since the content can't be edited by users, it will return false



 
HTML DOM Element isContentEditable


HTML DOM Element isContentEditable property

Element's content cannot be edited

Try to edit this content.

The above program returns "false", because the div element content can't be edited by users.

Supported Browsers

Property Chrome Edge Firefox Safari Opera
isContentEditable Yes Yes Yes Yes Yes
html_dom.htm
Advertisements