The Element API provides useful functions for manipulating and traversing the DOM. All of these elements are classed under $E. When using the Element or $E function, all Element functions that have their first argument as element are added to the element.
Element('element_id') -> HTMLElement
$E('element_id') -> HTMLElement
$E('element_id').next() -> HTMLElement
Element.next('element_id') -> HTMLElement
$E('element_id').insert({after: '<p>inserted text</p>'})
Element(id) -> HTMLElement
Returns the HTML Element for the given id.
Element.insert(element, insertions) -> HTMLElement
Inserts HTML into the page relative to the given element.
| Option | Description |
|---|---|
| after | Inserts the given HTML after the given element. |
| before | Inserts the given HTML before the given element. |
| bottom | Inserts the given HTML at the bottom of the given element's children. |
| top | Inserts the given HTML at the top of the given element's children. |
Element.next(element) -> HTMLElement
Returns the next sibling element relative to the given element.
Element.toggle(element) -> HTMLElement
Toggles the CSS display property to 'none', or '' if it is already 'none'.