Back to the lesson

Editable div

importance: 5

Create a <div> that turns into <textarea> when clicked.

The textarea allows to edit the HTML in the <div>.

When the user presses Enter or it looses focus, the <textarea> turns back into <div>, and its content becomes HTML in <div>.

Demo in new window

Open a sandbox for the task.