1.0.0 • Published 5 months ago
html_works_with_elem v1.0.0
HTML Helper
A simple library for working with HTML elements.
Installation
npm install html_works_with_elem
Usage
const {
createElement,
addClass,
removeClass,
setAttribute,
removeElement,
} = require("html_works_with_elem");
// Create a new element
const newDiv = createElement(
"div",
{ class: "my-class", id: "my-div" },
"Hello, world!"
);
document.body.appendChild(newDiv);
// Add a class
addClass(newDiv, "another-class");
// Remove a class
removeClass(newDiv, "my-class");
// Set an attribute
setAttribute(newDiv, "data-info", "some data");
// Remove an element
removeElement(newDiv);
1.0.0
5 months ago