TinyMCE:API/tinymce.dom.DOMUtils/create
From Moxiecode Documentation Wiki
Contents |
[edit]
Method: create
[edit]
Summary
Creates a new element.
[edit]
Syntax
<Element> create(<String> n, <Object> a, <String> h)
[edit]
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.
[edit]
Returns
HTML DOM node element that got created.
[edit]
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);
