Valid elements example
This example shows you how to use the extended_valid_elements option. This option enables you to override existing element serialization options and add new ones. The value of the extended_valid_elements option below will force the border attribute to 0 and default the class attribute to myclass, it will also make the src attribute required if it's omitted the whole element will be removed. It also displays how to use the invalid_elements option, this enables you to exclude specific elements from output.
HTML source
Below is all you need to setup the example.
<script type="text/javascript" src="<your installation path>/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
extended_valid_elements : "img[class=myclass|!src|border:0|alt|title|width|height]",
invalid_elements : "strong,b,em,i"
});
</script>
<form method="post" action="somepage">
<textarea id="content" name="content" cols="85" rows="10"></textarea>
</form>
More Examples
Here are more examples showing off different features of TinyMCE.
© 2003-2009