TinyMCE:API/tinymce.dom.DOMUtils/setAttrib

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Method: setAttrib

Summary

Sets the specified attributes value of a element or elements.

Syntax

<void> setAttrib(<Element/String/Array> e, <String> n, <String> v)

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.

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');
Personal tools