DEV Community

Amr Ataa
Amr Ataa

Posted on

Make Your Content Editable

Newer browsers have a nifty attribute that can be applied to elements, called contenteditable. As the name implies, this allows the user to edit any of the text contained within the element, including its children. There are a variety of uses for something like this, including an app as simple as a to-do list, which also takes advantage of local storage.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Making Content Editable</title>
</head>
<body>
    <h2>Editable To-Do List</h2>
    <ol contenteditable="true">
        <li>Break mechanical cab driver.</li>
        <li>Drive to abandoned factory.</li>
        <li>Watch video of self.</li>
    </ol>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)