# HTML5 and the contenteditable attribute



## dezingg (Feb 25, 2010)

Most of the current releases of web browsers now support *some* HTML5 features. The changes are designed to let a browser handle video, sound and working with graphics online without having to add plugins like Adobe's Flash and Apple's Quicktime players. The 'editablecontent' attribute intrigued me and I experimented with it.

To see more HTML5 features there's a pretty good introduction to HTML5 at http://www.w3schools.com/html5/default.asp I didn't think much of the HTML5 tutorials on other sites. I prefer simple examples so that I can test them without having to decipher all the extra css and jscript code that most websites have in their pages.
There is also an online HTML5 browser compatibility tester at http://html5test.com/ 

The code didn't display the way I thought it would, I guessed that the board used some sort of HTML parser, but it turns out that it uses BBcode, and BBcode is a lot more restrictive. 

Confusing me more is that I seem to be seeing two versions of this post, one with the code and one without. 
The code seems to be gone now. I was using the 'contenteditable' attribute within a span and inside a paragraph. Like so ...

<p><span contenteditable="true"> ... text to edit ... </span></p>


----------



## dezingg (Feb 25, 2010)

Well it looks like HT will let me post some basic HTML5 code. It turns out that the above example will not work unless you put in the HTML5 'doctype' declaration at the beginning of the HTML code. Believe it or not, the new HTML5 declaration is very short. Here's an HTML5 page stripped down.

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p><span contenteditable="true"> ... text to edit ... </span></p>
</body>
</html>


----------

