Skip to main content

DOM

addClass(ele, cls) ⇒ void

Add a classname to the Element's list of classnames.

ParamTypeDescription
eleelementThe Element to which the new class will be added
clsStringThe class to add to the Element

Example

pendo.dom.addClass(elem, 'foo')

dom(htmlString) ⇒ DomQuery

Creates new DOM elements from HTML text.

Returns: DomQuery - array with the newly created elements

ParamTypeDescription
htmlStringstringHTML syntax used to produce new DOM elements

Example

pendo.dom('<div><span>this should create an unattached DOM node</span></div>');

getClass(ele) ⇒ String

Get the classname for the Element.

ParamTypeDescription
eleelementThe Element referenced for the classname.

Example

var elemClass = pendo.dom.getClass(elem);

hasClass(ele, cls) ⇒ Boolean

Check if the Element has this classname.

ParamTypeDescription
eleelementThe Element to test for the classname
clsStringThe classname to look for on the element

Example

var hasFooClass = pendo.dom.hasClass(elem, 'foo');

removeClass(ele, cls) ⇒ void

Remove a classname from an Element's classlist.

ParamTypeDescription
eleelementThe Element from which the class will be removed
clsStringThe class to be removed

Example

pendo.dom.removeClass(elem, 'foo')

setClass(ele, cls) ⇒ void

Sets the classname for an Element.

ParamTypeDescription
eleelementThe Element that will get the new classlist.
clsStringThe classname that will be set.

Example

pendo.dom.setClass(elem, 'foo bar baz')