User Tools

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

  • .empty() – removes all of the element’s child nodes.
  • .load() – Loads an HTML snippet into an element.

More information

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information