TinyMCE:API/tinymce.dom.DOMUtils/create

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Method: create

Summary

Creates a new element.

Syntax

<Element> create(<String> n, <Object> a, <String> h)

Parameters

n
Name of new element.
a
Optional object name/value collection with element attributes.
h
Optional HTML string to set as inner HTML of the element.

Returns

HTML DOM node element that got created.

Examples

// Adds an element where the caret/selection is in the active editor
var el = tinyMCE.activeEditor.dom.create('div', {id : 'test', 'class' : 'myclass'}, 'some content');
tinyMCE.activeEditor.selection.setNode(el);
Personal tools