TinyMCE:API/tinymce.dom.DOMUtils/setAttrib
From Moxiecode Documentation Wiki
Contents |
[edit]
Method: setAttrib
[edit]
Summary
Sets the specified attributes value of a element or elements.
[edit]
Syntax
<void> setAttrib(<Element/String/Array> e, <String> n, <String> v)
[edit]
Parameters
- e
- DOM element, element id string or array of elements/ids to set attribute on.
- n
- Name of attribute to set.
- v
- Value to set on the attribute of this value is falsy like null 0 or it will remove the attribute instead.
[edit]
Examples
// Sets an attribute to all paragraphs in the active editor
tinyMCE.activeEditor.dom.setAttrib(tinyMCE.activeEditor.dom.select('p'), 'class', 'myclass');
// Sets an attribute to a specific element in the current page
tinyMCE.DOM.setAttrib('mydiv', 'class', 'myclass');
