Q:

How to make a div element editable in HTML

0

How to make a div element editable in HTML

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Use the HTML5 contenteditable Attribute

You can set the HTML5 contenteditable attribute with the value true (i.e. contentEditable="true") to make an element editable in HTML, such as <div> or <p> element.

Let's try out the following example to understand how it actually works:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Creating Editable Elements in HTML5</title>
</head>
<body>
    <h1 contentEditable="true">Your Name</h1>
    <div contentEditable="true">You Favorite Movie</div>
    <p contentEditable="true">Your Comment</p>
    <p><strong>Note:</strong> Click on the elements and type some text.</p>
</body>
</html>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

HTML / CSS Frequently Asked Questions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to disable resizable property of text area usi... >>
<< How to transform image size on mouse hover without...