DOM
Dom manipulation module
- Source:
Methods
-
<static> addClass(class)
-
Adds a class to the element(s) specified by the current selector
Parameters:
Name Type Description class
string - Source:
-
<static> append(htm)
-
Adds to the innerHTML of the current element, after the last child.
Parameters:
Name Type Description htm
string - Source:
Example
$_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
-
<static> attr(name, value) → {string}
-
Sets attributes on element(s) specified by the current selector, or, if name is not specified, returns the value of the attribute of the element specified by the current selector.
Parameters:
Name Type Argument Description name
string value
string <optional>
<nullable>
- Source:
Returns:
- Type
- string
-
<static> css(property, value) → {string}
-
Sets or retrieves a css property of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the css property on the current element. Accepts either key/value arguments, or an object with multiple key/value pairs.
Parameters:
Name Type Argument Description property
string | Object value
string <optional>
<nullable>
- Source:
Returns:
- Type
- string
-
<static> hide()
-
Hides the element(s) specified by the current selector
- Source:
-
<static> html(htm) → {string}
-
Sets or gets the innerHTML propery of the element(s) passed
Parameters:
Name Type Argument Description htm
string <optional>
<nullable>
- Source:
Returns:
- Type
- string
-
<static> prepend(htm)
-
Adds to the innerHTML of the selected element, before the current children
Parameters:
Name Type Description htm
string - Source:
-
<static> removeClass(class)
-
Removes a class from the element(s) specified by the current selector
Parameters:
Name Type Description class
string - Source:
-
<static> show(type)
-
Shows the element(s) specified by the current selector. if type is specified, the element will have it's style property set to "display:[your type]". If type is not specified, the element is set to "display:block".
Parameters:
Name Type Argument Description type
string <optional>
- Source:
-
<static> text(value) → {string}
-
Sets or retrieves the text content of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the current element
Parameters:
Name Type Argument Description value
string <optional>
<nullable>
- Source:
Returns:
- Type
- string