@akwaba/html
v1.0.1
Published
A collection of HTML utility methods
Downloads
6
Readme
@akwaba/html
Overview
A collection of HTML utility methods.
Published on npmjs.com as @akwaba/html
.
API
addClassName(element, className)
- Adds the given class name to the specified elementcreateElement(tagName, attributes, children)
- Creates an HTML element with the specified tag name, attributes, and childrendisable(element)
- Disables the specified elementenable(element)
- Enables the specified elementgetElement(id)
- Returns the HTML element with the specified ID (alias fordocument.getElementById
)getStyle(element, style)
- Retrieves the given style declaration on the specified elementhasClassName(element, className)
- Returns true if the element has the specified class name; otherwise, returns falsehide(element)
- Hides the specified element by setting its display tonone
isVisible(element)
- Returns true if the specified element is visible (display not set tonone
); otherwise, returns falseremoveClassName(element, className)
- Removes the specified class name from the given elementremove(element)
- Removes the specified element from its parentsetContent(element, html)
- Sets the HTML content for the specified elementsetStyle(element, styles)
- Sets CSS styles on the specified elementshow(element)
- Shows an element by setting its display toblock
toggleClassName(element, className)
- Toggles a class name on the specified element
Usage
import HTML from '@akwaba/html';
const element = HTML.createElement("div", { className: "container" });
console.log(element); // <div class="container"></div>
License
Copyright (c) 2019 Akwaba Systems, Inc.