Elements
Elements (Topic)
This topic contains all functions that are directly related to HTMLElements:
New elements
- HTMLElement.new() – creates a new HTMLElement [static method].
- .appendNew() – creates a new HTMLElement and attaches it as a child element (at the end)
- .prependNew() – creates a new HTMLElement and attaches it as a child element (at the beginning)
HTML functions
- .setHtml() – parses XHTML string and inserts the result as child nodes.
- .getHtml() – returns the
innerHTML
of an Element as String.
Text content
- .getText() – returns the entire text content of the Element (including from child nodes).
- .setText() – sets the entire text value of the Element (overriding existing child nodes).
- .appendText() – appends a new text node as the last child of the Element.
- .prependText() – prepends a new text node as the first child of the Element.
Attributes
- .getAttr() – returns the current value of an attribute of the Element.
- .setAttr() – sets the value of an attribute of the Element.
- .hasAttr() – returns true, if the Element has an attribute assigned.
Utility methods
More information
- HTMLElement on MDN.