Yes, we can do it with help of a unique HTML5 atribute i.e. contenteditable
. This is not only for div element but we can create any text element as editable. We just need to add content editable attribute like contenteditable="true"
and it's done.
You can also checkout out HTML example code snippet for this attaribute which is really helpful for doing some client side functionalities.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Create Editable HTML5 Elements</title>
</head>
<body>
<h1 name="title" contentEditable="true">Title</h1>
<p name="comments" contentEditable="true">Comment</p>
<div name="description" contentEditable="true">Description</div>
</body>
</html>
Supported Browsers:
- Internet Explorer
- Mozilla Firefox
- Google Chrome
- Opera
- Safari
HTML is base requirement for development of webpages. You can learn HTML from our HTML Tutorials and HTML Examples