HTML: Make Content Editable in Element / Tags without JavaScript

by Yang Yang on March 5, 2010

It’s not well known but this feature was invented by Microsoft and has been implemented across all major modern browsers ever since IE 5.5. Adding an attribute of contenteditable and assign a value of “true” to it makes the content value / inner text of that element editable by a single click:

<blockquote contenteditable="true">Click to edit me!</blockquote>

Try it live:

Click to edit me!

When you are done editing, just hit Enter (if it’s an inline element) or blur the cursor focus from the editing region (if it’s a block element). Theoretically, this attribute can be added to any HTML tags to make them immediately editable without the help of any JavaScript at all. You can add it to a div, a span or a td.

Now what can we do with this new trick?

Mike March 6, 2010 at 12:05 am

This is a great find – thanks!

I found this page:
It has a small compatibility table for this attribute. No support in FF2, but this page: shows that (as far as these stats go at least) there are few people still using FF.

Don’t know how I’m going to use this either!

Let us know when you get some ideas?

Yang Yang March 6, 2010 at 9:25 am

Hmmm, then I guess I’ll have to resist the idea to use it on any mission critical websites, but maybe hobby or experimental ones.

I’m trying to find a way to submit the edited content to the server, but thus far haven’t been lucky without JavaScript to help pass the value.

wensheng March 21, 2010 at 11:12 am

is same as

Comments on this entry are closed.

Previous post:

Next post: