TinyMCE:API/tinymce.Editor/setContent

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Method: setContent

Summary

Sets the specified content to the editor instance, this will cleanup the content before it gets set using the different cleanup rules options.

Syntax

<String> setContent(<String> h, <Object> o)

Parameters

h
Content to set to editor, normally HTML contents but can be other formats as well.
o
Optional content object, this gets passed around through the whole set process.

Returns

HTML string that got set into the editor.

Examples

// Sets the HTML contents of the activeEditor editor
tinyMCE.activeEditor.setContent('<span>some</span> html');

// Sets the raw contents of the activeEditor editor
tinyMCE.activeEditor.setContent('<span>some</span> html', {format : 'raw'});

// Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added
tinyMCE.activeEditor.setContent('[b]some[/b] html', {format : 'bbcode'});
Personal tools